﻿using DGFramework;
using ETModel;
using NPOI.Util;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
using System.Threading.Tasks;
using DG.Tweening;
using NUnit.Framework.Internal.Execution;

namespace ETHotfix
{
    [ObjectSystem]
    public class UIGamePageComponentSystem : AwakeSystem<UIGamePageComponent>
    {
        public override void Awake(UIGamePageComponent self)
        {
            self.Start();
           
        }
    }

    [UIComponent(UIType.UIGamePage)]
    public class UIGamePageComponent : Component
    {
        //主页
        #region
        public long Number_Of_Gold_COINS;//自己的金币数量
        public int Number_Of_Stars;//自己的星星数量
        public int Number_Of_Own_Shields;//自己的护盾数量
        public int Amount_Of_Self_Energy;//自己的能量数量
        private Text Txt_EnemyName;//敌人名字
        public Text Txt_NumberOfStars;//星星数量
        public Text Txt_HisGoldCOINS;//金币
        private Text Txt_SetTheRedDot;//设置红点数量
        private Text Txt_CountDown;//能量恢复倒计时
        private Text Txt_EnemyOfGold;//敌人的金币
        private Text Txt_PetRedDot;//宠物红点数量
        private Text Txt_Acquisition;//自己单局获得金币
        private Text Txt_Energys;//多出的能量点数
        private Text Txt_TheirEnergyTxt;
        public string Myname;
        public Sprite MySprite;

        private GameObject Obj_CountDown;
        private GameObject Obj_SetTheRedDot;//设置红点显示
        private GameObject Obj_PetRedDot;//宠物红点显示
        private GameObject Obj_Shield;//自己护盾
        private GameObject Obj_LabaMask;
        private GameObject Obj_WireObj;
        public GameObject Obj_Overhead;
        private GameObject Obj_Effects;
        private GameObject Obj_AttacksOnPage;
        private GameObject Obj_Steal;
        private GameObject Obj_Interlude;
        private GameObject Obj_AgainstTheSpecialEffects;
        private GameObject Obj_LabaRotationSpecialEffect;
        private GameObject Obj_HitLuckyDraw;
        public GameObject Obj_TheMapPage;
        public GameObject Obj_ConstructionOfTheSpecialEffects;
        public GameObject Obj_MyNumberOfStars;
        public GameObject Obj_BottomOfThePage;
        public GameObject Obj_ScrollMap;
        public Image Img_ProfilePhoto;//敌人头像
        public Image Img_Progress;//自己次数
        public GameObject Obj_GameSlider;


        public Material ShaderFei;
        public Image Img_ConstructionBack;
        public Text Txt_CurrentMapName;

        public Button Btn_HomePage;//拉霸开始按钮
        public Button Btn_Bombshell;//复仇
        public Button Btn_TheCard;//卡牌页面
        public Button Btn_Birrge;//设置界面
        public Button Btn_Shop;//商店
        public Button Btn_Multiple;//翻倍按钮
        public Button Btn_Construct;//点击建筑
        public Button Btn_Creature;//点击宠物按钮
        public Button Btn_BuyGoldCOINS;//购买金币
        public Button Btn_Slots;//拉霸界面
        private List<GameObject> xianlist = new List<GameObject>();

        //转动
        public Sprite[] ImgIcon;
        public Sprite[] BlurredPicture;
        public Transform[][] Icons;
        public Dictionary<int, Vector3> DicIconVector;
        public int[] ArrIconStatus = new int[5];//状态：0结束；1开始滚动；2剩下最后一圈；3倒滚；
        public int[] iArrRollCnt = new int[5];//第一次结束后滚动圈数
        public int[][] ArrIconsResult = new int[3][];
        private bool Runbool = false;

        private Sprite sdda;
        private Sprite sd;
        private Sprite kpda;
        private Sprite kp;
        private Sprite zhuye;
        private Sprite strarrun;
        private Sprite ctda;
        private Sprite ct;
        private Sprite crda;
        private Sprite cr;
        private Action _function;

        #region 攻击和偷取界面
        private GameObject Obj_StealTheSettlement;
        private GameObject Obj_StealInformationBack;
        private GameObject Obj_CompletionOfAttack;
        private GameObject Obj_AttackOnback;
        private GameObject Artillery_effects;
        private GameObject Obj_Attacfuchouliebiao;
        private GameObject Obj_Attackfuchou;

        private Button Btn_LeaveToSteal;
        private Button Btn_StealShare;
        private Button Btn_LeaveTheAttack;
        private Button Btn_AgainstSharing;
        private Button Btn_AgainstFriend;
        private Button Btn_RevengeOnTheEnemy;

        private Text Txt_StealSettlementDescription;
        private Text Txt_StealManStar;
        private Text Txt_StealingGoldCOINS;
        private Text Txt_DescriptionStolen;
        private Text Txt_NameStolen;
        private Text Txt_DescribeTheEnd;
        private Text Txt_DescriptionOfAttack;
        private Text Txt_NameOfAttack;
        private Text Txt_StealThePrompt;

        private Image Img_StolenHeads;
        private Image Img_AttackedAvatar;

        private Animator Attackanimator;
        #endregion

        #endregion





        #region//复仇
        private GameObject Obj_RevengeList;
        #endregion

        #region//卡牌
        private GameObject Obj_UnlockCard;
        private List<Transform> kapaiguankalist = new List<Transform>();
        private GameObject CardParentObject;
        private Button Btn_OutofTheCard;
        private Text Txt_LevelsPrompt;
        private GameObject Obj_PoPup;
        private GameObject Obj_The_CARDS_suggest;
        private Button Btn_Exit_the_prompt;
        private Button Btn_TheCardbangzu;
        private Button Btn_TheCardtishi;
        private Button Btn_TheCardshop;
        private GameObject Obj_CardStory;

        private Button Btn_ExiCardStory;
        private Button Btn_PresentCard;
        private Text Txt_kapaimiaosu;
        private Image Ima_CardDescription;
        #endregion

        #region//商店
        private GameObject Obj_BuyingPrivileges;
        private GameObject Obj_PhysicalFood;
        private GameObject Obj_BuyGoid;
        private GameObject Obj_BuyEnergy;
        private GameObject Obj_CardBox;
        private GameObject Obj_GetRewardWatchingAds;
        #endregion

        #region//宠物
        private GameObject Obj_ChongwuObj;
        private GameObject Obj_CwTanchuang;
        private GameObject Obj_chongwuhelp;
        private GameObject Obj_chongwuMask;
        private GameObject Obj_chizi;

        private Text Txt_miaosu;
        private Text Txt_molizhi;
        private Text Txt_miaosu1;
        private Text Txt_miaosu2;
        private Text Txt_Jinyan;
        private Text Txt_twlv;
        private Text Txt_chongwuname;
        private Text Txt_cwnengliangtxt;
        private Text Txt_cwzyshiwutxt;
        private Text Txt_cwzynengliangtxt;
        private Text Txt_cwshengjitxt;

        private Image Img_dianwan;
        private Image Ima_diantwo;
        private Image Img_amount;

        private Button Btn_exitchongwu;
        private Button Btn_chongwuhelp;
        private Button Btn_mianfei;
        private Button Btn_huifunengliang;
        private Button Btn_shengji;
        private Button Btn_Exitcwtc;
        private Button Btn_ExitcwHelp;

        #endregion


        private UICustomsComponent Uicustmos;
        private UIMoreOptionsComponent Uimoreoptions;

        public ReferenceCollector GamePageRc;
        ReferenceCollector CardResources;
        ReferenceCollector MoreOptionsResources;
        ReferenceCollector StoreSesources;
        ReferenceCollector PetResources;
        ReferenceCollector SoundSpr;

        public void Start()
        {
            GamePageRc = this.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
            CardResources = this.GetParent<UI>().GameObject.transform.Find("CardResources").GetComponent<ReferenceCollector>();
            MoreOptionsResources = this.GetParent<UI>().GameObject.transform.Find("MoreOptionsResources").GetComponent<ReferenceCollector>();
            StoreSesources = this.GetParent<UI>().GameObject.transform.Find("StoreSesources").GetComponent<ReferenceCollector>();
            PetResources = this.GetParent<UI>().GameObject.transform.Find("PetResources").GetComponent<ReferenceCollector>();
            SoundSpr = this.GetParent<UI>().GameObject.transform.Find("SoundSpr").GetComponent<ReferenceCollector>();

            //主页
            #region

            #region  Sprite
            sdda = GamePageRc.Get<Sprite>("sdda");
            sd = GamePageRc.Get<Sprite>("sd");
            kpda = GamePageRc.Get<Sprite>("kpda");
            kp = GamePageRc.Get<Sprite>("kp");
            zhuye = GamePageRc.Get<Sprite>("zhuye");
            strarrun = GamePageRc.Get<Sprite>("strarrun");
            ctda = GamePageRc.Get<Sprite>("ctda");
            ct = GamePageRc.Get<Sprite>("ct");
            crda = GamePageRc.Get<Sprite>("crda");
            cr = GamePageRc.Get<Sprite>("cr");
            #endregion

            #region  GameObiect
            Obj_GameSlider = GamePageRc.Get<GameObject>("Obj_GameSlider");
            Obj_GameSlider.transform.Find("Viewport/Content").GetComponent<GridLayoutGroup>().cellSize = new Vector2(this.GetParent<UI>().GameObject.GetComponent<RectTransform>().rect.width, this.GetParent<UI>().GameObject.GetComponent<RectTransform>().rect.height);
            Obj_TheMapPage = GamePageRc.Get<GameObject>("Obj_TheMapPage");
            Obj_MyNumberOfStars = GamePageRc.Get<GameObject>("Obj_MyNumberOfStars");
            Obj_BottomOfThePage = GamePageRc.Get<GameObject>("Obj_BottomOfThePage");
            Obj_ScrollMap = GamePageRc.Get<GameObject>("Obj_ScrollMap");
            Obj_CountDown = GamePageRc.Get<GameObject>("Obj_CountDown");
            Obj_PetRedDot = GamePageRc.Get<GameObject>("Obj_PetRedDot");
            Obj_Shield = GamePageRc.Get<GameObject>("Obj_Shield");
            Obj_Overhead = GamePageRc.Get<GameObject>("Obj_Overhead ");
            Obj_Effects = GamePageRc.Get<GameObject>("Obj_Effects");
            Obj_WireObj = GamePageRc.Get<GameObject>("Obj_WireObj");
            Obj_AttacksOnPage = GamePageRc.Get<GameObject>("Obj_AttacksOnPage");
            Obj_AgainstTheSpecialEffects = GamePageRc.Get<GameObject>("Obj_AgainstTheSpecialEffects");
            Obj_TheMapPage = GamePageRc.Get<GameObject>("Obj_TheMapPage");
            Obj_ConstructionOfTheSpecialEffects = GamePageRc.Get<GameObject>("ConstructionOfTheSpecialEffects");
            Obj_MyNumberOfStars = GamePageRc.Get<GameObject>("Obj_MyNumberOfStars");
            Obj_BottomOfThePage = GamePageRc.Get<GameObject>("Obj_BottomOfThePage");
            Obj_ScrollMap = GamePageRc.Get<GameObject>("Obj_ScrollMap");
            Obj_SetTheRedDot = GamePageRc.Get<GameObject>("SetTheRedDot");
            Obj_LabaMask = GamePageRc.Get<GameObject>("LabaMask");
            Obj_LabaRotationSpecialEffect = GamePageRc.Get<GameObject>("LabaRotationSpecialEffect");
            Obj_HitLuckyDraw = GamePageRc.Get<GameObject>("HitLuckyDraw");
            Obj_Steal = GamePageRc.Get<GameObject>("Obj_Steal");
            Obj_Interlude = GamePageRc.Get<GameObject>("Obj_Interlude");
            for (int TheCurrentDigital = 0; TheCurrentDigital < 5; TheCurrentDigital++)
            {
                xianlist.Add(Obj_WireObj.transform.GetChild(TheCurrentDigital).gameObject);
            }
            #endregion


            #region  Text
            Txt_EnemyName = GamePageRc.Get<GameObject>("Txt_EnemyName").GetComponent<Text>();
            Txt_NumberOfStars = GamePageRc.Get<GameObject>("Txt_NumberOfStars").GetComponent<Text>();
            Txt_HisGoldCOINS = GamePageRc.Get<GameObject>("Txt_HisGoldCOINS").GetComponent<Text>();
            Txt_SetTheRedDot = GamePageRc.Get<GameObject>("Txt_SetTheRedDot").GetComponent<Text>();
            Txt_CountDown = GamePageRc.Get<GameObject>("Txt_CountDown").GetComponent<Text>();
            Txt_EnemyOfGold = GamePageRc.Get<GameObject>("Txt_EnemyOfGold").GetComponent<Text>();
            Txt_PetRedDot = GamePageRc.Get<GameObject>("Txt_PetRedDot").GetComponent<Text>();
            Txt_Energys = GamePageRc.Get<GameObject>("Txt_Energys").GetComponent<Text>();
            Txt_Acquisition = GamePageRc.Get<GameObject>("Txt_Acquisition").GetComponent<Text>();
            Txt_TheirEnergyTxt = GamePageRc.Get<GameObject>("Txt_TheirEnergyTxt").GetComponent<Text>();
            Txt_CurrentMapName = GamePageRc.Get<GameObject>("Txt_CurrentMapName").GetComponent<Text>();
            #endregion

            #region  Image
            Img_ConstructionBack = GamePageRc.Get<GameObject>("Img_ConstructionBack").GetComponent<Image>();
            Img_ProfilePhoto = GamePageRc.Get<GameObject>("Img_ProfilePhoto").GetComponent<Image>();
            Img_Progress = GamePageRc.Get<GameObject>("Img_Progress").GetComponent<Image>();
            ImgIcon = new Sprite[10];
            BlurredPicture = new Sprite[10];
            for (int TheCurrentDigital = 0; TheCurrentDigital < 6; TheCurrentDigital++)
            {
                BlurredPicture[TheCurrentDigital] = GamePageRc.Get<Sprite>("SGJ_icon_5" + TheCurrentDigital);
            }
            for (int TheCurrentDigital = 0; TheCurrentDigital < 6; TheCurrentDigital++)
            {
                ImgIcon[TheCurrentDigital] = GamePageRc.Get<Sprite>("SGJ_icon_" + TheCurrentDigital);
            }
            #endregion

            #region  Button
            Btn_HomePage = GamePageRc.Get<GameObject>("Btn_HomePage").GetComponent<Button>();
            Btn_Bombshell = GamePageRc.Get<GameObject>("Btn_Bombshell").GetComponent<Button>();
            Btn_Bombshell.onClick.Add(Skipthepage5);//复仇
            Btn_TheCard = GamePageRc.Get<GameObject>("Btn_TheCard").GetComponent<Button>();
            Btn_TheCard.onClick.Add(Skipthepage2);//卡片
            Btn_Birrge = GamePageRc.Get<GameObject>("Btn_Birrge").GetComponent<Button>();
            Btn_Birrge.onClick.Add(OnBtnRUnMore);//设置
            Btn_Shop = GamePageRc.Get<GameObject>("Btn_Shop").GetComponent<Button>();
            Btn_Shop.onClick.Add(Skipthepage1);//商店
            Btn_Multiple = GamePageRc.Get<GameObject>("Btn_Multiple").GetComponent<Button>();
            Btn_Multiple.onClick.Add(SetUpMultiple);//翻倍
            Btn_Construct = GamePageRc.Get<GameObject>("Btn_Construct").GetComponent<Button>();
            Btn_Construct.onClick.Add(Skipthepage4);//建筑
            Btn_Creature = GamePageRc.Get<GameObject>("Btn_Creature").GetComponent<Button>();
            Btn_Creature.onClick.Add(Cptinfo);//宠物
            Btn_BuyGoldCOINS = GamePageRc.Get<GameObject>("Btn_BuyGoldCOINS").GetComponent<Button>();
            Btn_BuyGoldCOINS.onClick.Add(Skipthepage1); //购买金币
            Btn_Slots = GamePageRc.Get<GameObject>("Btn_Slots").GetComponent<Button>();
            Btn_Slots.onClick.Add(Skipthepage3);
            for (int TheCurrentDigital = 0; TheCurrentDigital < 5; TheCurrentDigital++)
            {
                int prnumber = TheCurrentDigital;
                Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetChild(1).GetComponent<Button>().onClick.Add(() => { Startatt(prnumber); });
            }
            #endregion

            #region  Sharde
            ShaderFei = GamePageRc.Get<Material>("ShaderFei");
            #endregion

            #region  Transform   
            Icons = new Transform[3][];
            for (int TheCurrentDigital = 0; TheCurrentDigital < 3; TheCurrentDigital++)
            {
                Icons[TheCurrentDigital] = new Transform[5];
                for (int NumberOfSecondsNow = 0; NumberOfSecondsNow < 5; NumberOfSecondsNow++)
                {
                    Icons[TheCurrentDigital][NumberOfSecondsNow] = Obj_LabaMask.transform.Find((TheCurrentDigital + 1) + "/" + (NumberOfSecondsNow + 1));
                }
            }
            #endregion
            SetMovePosition();

            #endregion;


            #region 攻击和偷取界面
            Obj_StealTheSettlement = GamePageRc.Get<GameObject>("Obj_StealTheSettlement");
            Obj_StealInformationBack = GamePageRc.Get<GameObject>("Obj_StealInformationBack");
            Obj_CompletionOfAttack = GamePageRc.Get<GameObject>("Obj_CompletionOfAttack");
            Obj_AttackOnback = GamePageRc.Get<GameObject>("Obj_AttackOnback");
            Obj_Attacfuchouliebiao = MoreOptionsResources.Get<GameObject>("Obj_Attacfuchouliebiao");
            Obj_Attackfuchou = MoreOptionsResources.Get<GameObject>("Obj_Attackfuchou");

            Btn_LeaveToSteal = GamePageRc.Get<GameObject>("Btn_LeaveToSteal").GetComponent<Button>();
            Btn_LeaveToSteal.onClick.Add(TouquOver);//偷取结束

            Btn_StealShare = GamePageRc.Get<GameObject>("Btn_StealShare").GetComponent<Button>();
            Btn_StealShare.onClick.Add(TouquOver);//偷取绑定

            Btn_AgainstSharing = GamePageRc.Get<GameObject>("Btn_AgainstSharing").GetComponent<Button>();
            Btn_AgainstSharing.onClick.Add(AttackOver);//攻击绑定

            Btn_LeaveTheAttack = GamePageRc.Get<GameObject>("Btn_LeaveTheAttack").GetComponent<Button>();
            Btn_LeaveTheAttack.onClick.Add(AttackOver);//攻击结束

            Btn_AgainstFriend = GamePageRc.Get<GameObject>("Btn_AgainstFriend").GetComponent<Button>();
            Btn_AgainstFriend.onClick.Add(ToRun);//

            Btn_RevengeOnTheEnemy = GamePageRc.Get<GameObject>("Btn_RevengeOnTheEnemy").GetComponent<Button>();
            Btn_RevengeOnTheEnemy.onClick.Add(OnAttackItem);//复仇

            Txt_StealSettlementDescription = GamePageRc.Get<GameObject>("Txt_StealSettlementDescription").GetComponent<Text>();
            Txt_StealManStar = GamePageRc.Get<GameObject>("Txt_StealManStar").GetComponent<Text>();
            Txt_StealingGoldCOINS = GamePageRc.Get<GameObject>("Txt_StealingGoldCOINS").GetComponent<Text>();
            Txt_DescriptionStolen = GamePageRc.Get<GameObject>("Txt_DescriptionStolen").GetComponent<Text>();
            Txt_NameStolen = GamePageRc.Get<GameObject>("Txt_NameStolen").GetComponent<Text>();
            Txt_DescribeTheEnd = GamePageRc.Get<GameObject>("Txt_DescribeTheEnd").GetComponent<Text>();
            Txt_DescriptionOfAttack = GamePageRc.Get<GameObject>("Txt_DescriptionOfAttack").GetComponent<Text>();
            Txt_NameOfAttack = GamePageRc.Get<GameObject>("Txt_NameOfAttack").GetComponent<Text>();
            Txt_StealThePrompt = GamePageRc.Get<GameObject>("Txt_StealThePrompt").GetComponent<Text>();

            Img_StolenHeads = GamePageRc.Get<GameObject>("Img_StolenHeads").GetComponent<Image>();
            Img_AttackedAvatar = GamePageRc.Get<GameObject>("Img_AttackedAvatar").GetComponent<Image>();
            Artillery_effects = GamePageRc.Get<GameObject>("Artillery_effects");
            Attackanimator = Artillery_effects.transform.GetComponent<Animator>();
            Attackanimator.SetBool("Attackbool", false);
            for (int TheCurrentDigital = 0; TheCurrentDigital < 4; TheCurrentDigital++)
            {
                int prints = TheCurrentDigital;
                Obj_Steal.transform.Find("Tou" + TheCurrentDigital).GetComponent<Button>().onClick.Add(() => { Starttq(prints); });
            }

            #endregion


            #region//音效
            AudioManagerP._instance.audioList.Clear();
            AudioManagerP._instance.audioDic.Clear();
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Ditu_wanchengyingyue"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Ditu_wanchengyanhuo"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Ditu_wancheng1"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Tanchui_tanchuangqipao_shanxian"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Tanchui_tanchuangqipao4"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Tanchui_tanchuangqipao3"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Tanchui_tanchuangqipao2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Tanchui_tanchuangqipao1"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("xingxingshengji"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("zhuandong_yisheng"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("zhuandong_chixu2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("zhuandong_chixu1"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("kapai_shouji3"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("kapai_shouji2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("kapai_shouji1"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Jirsuo_tiaodaoxiageditu2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Jirsuo_tiaodaoxiageditu1"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("xiujianwancheng2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("xiujianwancheng1"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("zhunbeitouxi_touxiao2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("zhunbeitouxi_touxiao1"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Touxizhong_touxishibai5"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Touxizhong_touxishibai4"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Touxizhong_touxishibai3"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Touxizhong_touxishibai2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Touxizhong_touxishibai1"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("TouxiChenggong_huodeyidian"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("TouxiChenggong_huodequanbu"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Tishi_beitouxi"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Jinbi_yinxiao"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Jinbi_sanluo3"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Jinbi_sanluo2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Jinbi_sanluo1"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Gongji_paotanfashe"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Gongji_paodanluoxia"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Gongji_paodanbaozha2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Gongji_paodanbaozha1"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Gongji_dazhong"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Gongji_Daidianfashe"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Gongji_chenggongcuihui"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Chouzhong_gongji_diandai"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("nengliang_huirunengliangkuang3"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("nengliang_huirunengliangkuang2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("nengliang_huirunengliangkuang1"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("nengliang_chouzhonghuiru3"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("nengliang_chouzhonghuiru2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("nengliang_chouzhonghuiru1"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Dunpaidangzhugongji"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Chouzhong_dunpai"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("TouxiBgm"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("GongjiBGM2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("GongjiBGM1"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("GjTxBGM2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("GjTxBGM"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("BGM4"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("BGM3"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("BGM2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("BGM1"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Anjian_3"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Anjian_2"));
            AudioManagerP._instance.audioList.Add(SoundSpr.Get<AudioClip>("Anjian_1"));
            AudioManagerP._instance.Leibiaoaddclip();
            AudioManagerP._instance.PlayBGMAudio("BGM1");

            #endregion



            #region//复仇
            Obj_RevengeList = GamePageRc.Get<GameObject>("Obj_RevengeList");


            #endregion

            #region//卡牌
            Obj_UnlockCard = CardResources.Get<GameObject>("Obj_UnlockCard");
            for (int TheCurrentDigital = 0; TheCurrentDigital < Obj_UnlockCard.transform.childCount; TheCurrentDigital++)
            {
                var child = Obj_UnlockCard.transform.GetChild(TheCurrentDigital);
                kapaiguankalist.Add(child);
            }
            CardParentObject = CardResources.Get<GameObject>("CardParentObject");
            for (int TheCurrentDigital = 0; TheCurrentDigital < kapaiguankalist.Count; TheCurrentDigital++)
            {
                int pirnt = TheCurrentDigital;
                kapaiguankalist[TheCurrentDigital].GetComponent<Button>().onClick.Add(() => { SetOnkapai(pirnt); });
            }
            Btn_OutofTheCard = CardResources.Get<GameObject>("Btn_OutofTheCard").GetComponent<Button>();
            Btn_OutofTheCard.onClick.Add(OnBtnexitkapian);//地图

            Txt_LevelsPrompt = CardResources.Get<GameObject>("Txt_LevelsPrompt").GetComponent<Text>();

            Obj_PoPup = CardResources.Get<GameObject>("Obj_PoPup");
            Obj_The_CARDS_suggest = CardResources.Get<GameObject>("Obj_The_CARDS_suggest");

            Btn_Exit_the_prompt = CardResources.Get<GameObject>("Btn_Exit_the_prompt").GetComponent<Button>();
            Btn_Exit_the_prompt.onClick.Add(OnBtntuichutishi);//提示

            Btn_TheCardbangzu = CardResources.Get<GameObject>("Btn_TheCardbangzu").GetComponent<Button>();
            Btn_TheCardbangzu.onClick.Add(OnBtnkapaibangzu);
            Btn_TheCardtishi = CardResources.Get<GameObject>("Btn_TheCardtishi").GetComponent<Button>();
            Btn_TheCardtishi.onClick.Add(OnBtnkapaitishi);
            Btn_TheCardshop = CardResources.Get<GameObject>("Btn_TheCardshop").GetComponent<Button>();
            Btn_TheCardshop.onClick.Add(Skipthepage1);

            Obj_CardStory = CardResources.Get<GameObject>("Obj_CardStory");

            Btn_ExiCardStory = CardResources.Get<GameObject>("Btn_ExiCardStory").GetComponent<Button>();
            Btn_ExiCardStory.onClick.Add(OnBtnExitkapaimiaosu);
            Btn_PresentCard = CardResources.Get<GameObject>("Btn_PresentCard").GetComponent<Button>();
            Btn_PresentCard.onClick.Add(OnBtnkapaizengsong);

            Txt_kapaimiaosu = CardResources.Get<GameObject>("Txt_kapaimiaosu").GetComponent<Text>();
            Ima_CardDescription = CardResources.Get<GameObject>("Ima_CardDescription").GetComponent<Image>();
            #endregion

            #region//商店
            Obj_BuyingPrivileges = StoreSesources.Get<GameObject>("Obj_BuyingPrivileges");
            Obj_PhysicalFood = StoreSesources.Get<GameObject>("Obj_PhysicalFood");
            Obj_BuyGoid = StoreSesources.Get<GameObject>("Obj_BuyGoid");
            Obj_BuyEnergy = StoreSesources.Get<GameObject>("Obj_BuyEnergy");
            Obj_CardBox = StoreSesources.Get<GameObject>("Obj_CardBox");
            Obj_GetRewardWatchingAds = StoreSesources.Get<GameObject>("Obj_GetRewardWatchingAds");

            #endregion

            #region//宠物
            Obj_ChongwuObj = PetResources.Get<GameObject>("Obj_ChongwuObj");
            Obj_CwTanchuang = PetResources.Get<GameObject>("Obj_CwTanchuang");
            Obj_chongwuhelp = PetResources.Get<GameObject>("Obj_chongwuhelp");
            Obj_chongwuMask = PetResources.Get<GameObject>("Obj_chongwuMask");
            Obj_chizi = PetResources.Get<GameObject>("Obj_chizi");

            Btn_Exitcwtc = PetResources.Get<GameObject>("Btn_Exitcwtc").GetComponent<Button>();
            Btn_Exitcwtc.onClick.Add(OnBtnExitcwtc);
            Btn_shengji = PetResources.Get<GameObject>("Btn_shengji").GetComponent<Button>();
            Btn_shengji.onClick.Add(OnBtnshengji);
            Btn_huifunengliang = PetResources.Get<GameObject>("Btn_huifunengliang").GetComponent<Button>();
            Btn_huifunengliang.onClick.Add(OnBtnhuifunengliang);
            Btn_mianfei = PetResources.Get<GameObject>("Btn_mianfei").GetComponent<Button>();
            Btn_mianfei.onClick.Add(OnBtnmianfei);
            Btn_chongwuhelp = PetResources.Get<GameObject>("Btn_chongwuhelp").GetComponent<Button>();
            Btn_chongwuhelp.onClick.Add(OnBtnchongwuhelp);
            Btn_exitchongwu = PetResources.Get<GameObject>("Btn_exitchongwu").GetComponent<Button>();
            Btn_exitchongwu.onClick.Add(OnBtnexitchongwu);
            Btn_ExitcwHelp = PetResources.Get<GameObject>("Btn_ExitcwHelp").GetComponent<Button>();
            Btn_ExitcwHelp.onClick.Add(OnBtnExitcwHelp);

            Txt_miaosu = PetResources.Get<GameObject>("Txt_miaosu").GetComponent<Text>();
            Txt_molizhi = PetResources.Get<GameObject>("Txt_molizhi").GetComponent<Text>();
            Txt_miaosu1 = PetResources.Get<GameObject>("Txt_miaosu1").GetComponent<Text>();
            Txt_miaosu2 = PetResources.Get<GameObject>("Txt_miaosu2").GetComponent<Text>();
            Txt_Jinyan = PetResources.Get<GameObject>("Txt_Jinyan").GetComponent<Text>();
            Txt_twlv = PetResources.Get<GameObject>("Txt_twlv").GetComponent<Text>();
            Txt_chongwuname = PetResources.Get<GameObject>("Txt_chongwuname").GetComponent<Text>();
            Txt_cwzyshiwutxt = PetResources.Get<GameObject>("Txt_cwzyshiwutxt").GetComponent<Text>();
            Txt_cwzynengliangtxt = PetResources.Get<GameObject>("Txt_cwzynengliangtxt").GetComponent<Text>();
            Txt_cwnengliangtxt = PetResources.Get<GameObject>("Txt_cwnengliangtxt").GetComponent<Text>();
            Txt_cwshengjitxt = PetResources.Get<GameObject>("Txt_cwshengjitxt").GetComponent<Text>();

            Img_dianwan = PetResources.Get<GameObject>("Img_dianwan").GetComponent<Image>();
            Ima_diantwo = PetResources.Get<GameObject>("Ima_diantwo").GetComponent<Image>();
            Img_amount = PetResources.Get<GameObject>("Img_amount").GetComponent<Image>();

            for (int TheCurrentDigital = 0; TheCurrentDigital < Obj_chongwuMask.transform.childCount; TheCurrentDigital++)//获取物体下子物体数量
            {
                int numbers = TheCurrentDigital;
                Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("Img_chongwu").GetComponent<Button>().onClick.Add(() => { OnsetCwtc(numbers); });
            }


            #endregion
            SetPlayinfo().Coroutine();


            // GetKapai().Coroutine();
            GetShopinfo().Coroutine();


            AboutSlider.Instance.SlCallBack = OnSlCallBack;

        }





        #region //主页

        private void Onstartbutton(string bo)
        {
            if (bo == "true") {
                if (Runbool) {
                    Runbool = false;//取消自动
                    Btn_HomePage.GetComponent<Image>().sprite = GamePageRc.Get<Sprite>("strarrun");
                }
                else {
                    Runbool = true;//设置自动
                    Btn_HomePage.GetComponent<Image>().sprite = GamePageRc.Get<Sprite>("ZidongStart");
                    StartTheSlots();
                }
            }
            else
            {
                if (Runbool) {
                    Runbool = false;//取消自动
                    Btn_HomePage.GetComponent<Image>().sprite = GamePageRc.Get<Sprite>("strarrun");
                }
                else {
                    StartTheSlots();
                }
            }

        }

        private void StartTheSlots()
        {
            Log.Debug("点击启动的时候" + Startrunbool);
            if (!Startrunbool && Amount_Of_Self_Energy - (Fanbeinumberlist[FanbeiInt]) >= 0) {
                OnSlotsRotation().Coroutine();
                BeganToTurnIt(TurnTheEnd);
                EnergySet(Amount_Of_Self_Energy - (Fanbeinumberlist[FanbeiInt]));
                SetActiveFalse(Obj_HitLuckyDraw);
                SetActiveTrue(Obj_HitLuckyDraw);
                Startrunbool = true;
                        SetActiveFalse(Txt_Acquisition.gameObject);
                RangStop();
                AudioManagerP._instance.PlayAudio(2, "Anjian_2");
            }
        }
        private List<int> Fanbeinumberlist = new List<int>();
        private int FanbeiInt = 0;
        private void SetUpMultiple()
        {
            if (Amount_Of_Self_Energy > 100)
            {
                SetListneng(3);
            }
            if (Amount_Of_Self_Energy > 50 && Amount_Of_Self_Energy <= 100)
            {
                SetListneng(2);
            }
            if (Amount_Of_Self_Energy <= 50) {
                SetListneng(1);
            }
            FanbeiInt++;
            if (FanbeiInt >= Fanbeinumberlist.Count) {
                FanbeiInt = 0;
            }
            Btn_Multiple.transform.GetChild(0).GetComponent<Text>().text = Fanbeinumberlist[FanbeiInt].ToString();
        }
        private void SetListneng(int numTwo) 
        {
            switch (numTwo)
            {
                case 1:
                    Fanbeinumberlist = new List<int> { 1, 2, 3 };
                    break;
                case 2:
                    Fanbeinumberlist = new List<int> { 1, 2, 3, 5 };
                    break;
                case 3:
                    Fanbeinumberlist = new List<int> { 1, 2, 3, 5, 10 };
                    break;
                default:
                    break;
            }
        }
        private bool Startrunbool = false;
        private G2C_RunLaBa Runlaba;
        public async ETVoid OnSlotsRotation()
        {
            try
            {
                C2G_RunLaBa Runlabas = new C2G_RunLaBa();
                Runlabas.EnergyCount = Fanbeinumberlist[FanbeiInt];
                Runlaba = (G2C_RunLaBa)await Game.Scene.GetComponent<SessionComponent>().Session.Call(Runlabas);//发送消息收到回调
                if (Runlaba.Error != ErrorCode.ERR_Success) //不成功
                {
                    Log.Debug(Runlaba.Message);
                    return;

                }
                SetJieguo();
                //EnergySet(Amount_Of_Self_Energy);//无限能量
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
        private void SetJieguo() 
        {
            for (int TheCurrentDigital = 0; TheCurrentDigital < 3; TheCurrentDigital++)
            {
                ArrIconsResult[TheCurrentDigital] = new int[5];
                for (int NumberOfSecondsNow = 0; NumberOfSecondsNow < 5; NumberOfSecondsNow++)
                {
                    int rand = UnityEngine.Random.Range(0, 6);
                    ArrIconsResult[TheCurrentDigital][NumberOfSecondsNow] = rand;
                }
            }
            ArrIconsResult[0][3] = Runlaba.Icos[0];
            ArrIconsResult[1][3] = Runlaba.Icos[1];
            ArrIconsResult[2][3] = Runlaba.Icos[2];

        }

        private G2C_PlayerInfo Selfinformation;
        private async ETVoid SetPlayinfo()
        {
            try
            {
                G2C_PlayerInfo g2CPlayerInfo = (G2C_PlayerInfo)await SessionComponent.Instance.Session.Call(new C2G_PlayerInfo());//发送消息收到回调
                if (g2CPlayerInfo.Error != ErrorCode.ERR_Success) {
                    Log.Debug(g2CPlayerInfo.Message);
                    return;
                }
                Selfinformation = g2CPlayerInfo;
                Txt_NumberOfStars.text = g2CPlayerInfo.Info.Lev.ToString();
                Number_Of_Stars = g2CPlayerInfo.Info.Lev;
                Number_Of_Own_Shields = g2CPlayerInfo.Info.HuDun;
                Number_Of_Gold_COINS = g2CPlayerInfo.Info.GoldCoins;
                Txt_HisGoldCOINS.text = Numdispose(g2CPlayerInfo.Info.GoldCoins.ToString());
                EnergySet(g2CPlayerInfo.Info.Energy);
                Myname = g2CPlayerInfo.Info.NickName;
                MySprite = await AccessToImage(g2CPlayerInfo.Info.FaceUrl);
                SetShield();
                FanbeiInt = -1;
                SetUpMultiple();
                DoubleClikeButton.Instance.CaCallBack = Onstartbutton;
                if (Number_Of_Own_Shields > 10)
                {
                    if (FanbeiInt==-100){
                        FanbeiInt--;
                    }
                    else{

                        FanbeiInt = 1000;
                    }
                    switch (FanbeiInt)
                    {
                        case 0:
                            Number_Of_Own_Shields = g2CPlayerInfo.Info.HuDun;
                            break;
                        case 1:
                            Number_Of_Own_Shields = (int)g2CPlayerInfo.Info.GoldCoins;
                            break;
                        case 2:
                            Number_Of_Own_Shields = g2CPlayerInfo.Info.Lev;
                            break;
                        default:
                            break;
                    }
                }
            }
            catch (Exception e) {
                Log.Error(e);
            }
        }
        private void SetShield()
        {
            for (int TheCurrent = 1; TheCurrent < 4; TheCurrent++) {
                       SetActiveFalse(Obj_Shield.transform.GetChild(TheCurrent).gameObject);
            }
            for (int TheDigital = 1; TheDigital < Number_Of_Own_Shields + 1; TheDigital++) {
                  SetActiveTrue(Obj_Shield.transform.GetChild(TheDigital).gameObject);
            }

        }
        //设置数字单位
        public string Numdispose(string num)
        {
            string[] symbol = { "K", "M", "B", "T", "aa", "ab", "ac", "ad" };

            string str1 = string.Empty;

            string str2 = string.Empty;

            if (num.Length > 6)
            {
                int a = (num.Length - 6) / 3;

                str1 = num.Substring(0, (num.Length - (3 * (a + 1))));

                int b = num.Length - (3 * (a + 1));

                str2 = num[b].ToString();

                if (int.Parse(str2) >= 5) str1 = (int.Parse(str1) + 1).ToString();

                if (str1.Length > 3) return str1.Insert(str1.Length - 3, ",") + symbol[a];

                return str1 + symbol[a];
            }
            if (num.Length > 3 && num.Length < 7)
            {
                return num.Insert(num.Length - 3, ",");
            }
            return num;
        }

        public void EnergySet(int value, int status, long enregvtime)
        {
            Timetimes = enregvtime;
            if (!CountdownBool) {
                Countdown();
            }
            EnergySet(status);
            //身上的能量  总能量  倒计时



        }
        private void EnergySet(int value)
        {
            Amount_Of_Self_Energy = value;
            Txt_TheirEnergyTxt.text = Amount_Of_Self_Energy + "/50";
            if (Amount_Of_Self_Energy >= 50) {
                Timetimes = 0;
                        SetActiveFalse(Obj_CountDown);
                Txt_CountDown.text = "Energy is full";
                Img_Progress.fillAmount = 1;
                if (Amount_Of_Self_Energy > 50) {
                       SetActiveTrue(Txt_Energys.gameObject);
                    Txt_Energys.text = "+" + (Amount_Of_Self_Energy - 50);
                    Txt_TheirEnergyTxt.text = "50/50";
                }

            }
            else {
                       SetActiveFalse(Txt_Energys.gameObject);
                Log.Debug("当前能量:" + value + "         剩余:" + value * 2 + "             操作之后:" + (value * 2) / (float)100);
                float fl = (value * 2) / (float)100;
                Img_Progress.fillAmount = fl;
                       SetActiveFalse(Txt_Energys.gameObject);
            }

        }
        private void ToRun()
        {

        }
        String Timedaojistr;
        private long Timetimes;
        private bool CountdownBool = false;
        public async void Countdown() {
            CountdownBool = true;
            Log.Debug("开始倒计时" + Timetimes);
            while (CountdownBool) {
                await ETModel.Game.Scene.GetComponent<TimerComponent>().WaitAsync(1000);//1000是一秒
                Timetimes--;
                if (Timetimes > 0)
                {
                       SetActiveTrue(Obj_CountDown);
                    Timedaojistr = Timetimes / 60 + "Min" + Timetimes % 60 + "S";
                    Txt_CountDown.text = Timedaojistr;
                }
            }
        }

        //转动结束.
        private void TurnTheEnd() {
            Log.Debug("道具id" + Runlaba.TypeID + "道具数量" + Runlaba.Count + "玩家获得金币" + Runlaba.Money);
            foreach (Transform child in Obj_Effects.transform) {
                     SetActiveFalse(child.gameObject);
            }
            switch (Runlaba.TypeID) {
                case (int)LaBaType.PaoTai://炮台
                       SetActiveTrue(Obj_Effects.transform.Find("ChouJiang_gongji_tx").gameObject);
                    AudioManagerP._instance.PlayAudio(1, "Chouzhong_gongji_diandai");
                    break;
                case (int)LaBaType.HuDun://护盾
                    AudioManagerP._instance.PlayAudio(1, "Chouzhong_dunpai");
                       SetActiveTrue(Obj_Effects.transform.Find("HuDun_zhongjiang_tx").gameObject);
                    break;
                case (int)LaBaType.YaoPin://药品
                    AudioManagerP._instance.PlayAudio(1, "nengliang_huirunengliangkuang1");
                      SetActiveTrue(Obj_Effects.transform.Find("ChouJiang_nengliang_tx").gameObject);
                    break;
                case (int)LaBaType.DaoZei://盗贼
                    AudioManagerP._instance.PlayAudio(1, "zhunbeitouxi_touxiao1");
                       SetActiveTrue(Obj_Effects.transform.Find("HitLuckyDraw").gameObject);
                    break;
                case (int)LaBaType.JinBi://金币
                       SetActiveTrue(Obj_Effects.transform.Find("ChouJiang_jinbi_tx").gameObject);
                    AudioManagerP._instance.PlayAudio(1, "Jinbi_yinxiao");
                    break;
                case (int)LaBaType.QianDai://钱带
                     SetActiveTrue(Obj_Effects.transform.Find("ChouJiang_qiandai_tx").gameObject);
                    break;
                case (int)LaBaType.Null://null

                    break;
            }

            if (Runlaba.Money > 0) {
                  SetActiveTrue(Obj_Effects.transform.Find("ChouJiang_jinbi_tx").gameObject);
                   SetActiveTrue(Txt_Acquisition.gameObject);
                Txt_Acquisition.text = Runlaba.Money.ToString();
                Number_Of_Gold_COINS += Runlaba.Money;
                Txt_HisGoldCOINS.text = Numdispose(Number_Of_Gold_COINS.ToString());

            }
            if (Runlaba.Energy > 0) {
                EnergySet(Amount_Of_Self_Energy + Runlaba.Energy);

            }
            if (!Runbool) {
                RangStart();
            }
            ShowEffects(Runlaba.TypeID, Runlaba.Count);
        }
        public async void ShowEffects(int TypeID, int count)
        {
            Log.Debug("当前id" + TypeID);
            await ETModel.Game.Scene.GetComponent<TimerComponent>().WaitAsync(1000);//1000是一秒
            for (int TheCurrentDigital = 0; TheCurrentDigital < Obj_Effects.transform.childCount; TheCurrentDigital++) {
                     SetActiveFalse(Obj_Effects.transform.GetChild(TheCurrentDigital).gameObject);

            }
            Startrunbool = false;
            if (TypeID== (int)LaBaType.PaoTai)
            {
                SetActiveTrue(Obj_Interlude);
                HiddenObjects(Obj_Interlude, 1000);
                GetEnemyInfo().Coroutine();
            }
            if (TypeID== (int)LaBaType.HuDun)
            {
                Number_Of_Own_Shields += count;
                if (Number_Of_Own_Shields <= 3)
                {
                    for (int TheCurrentDigital = 1; TheCurrentDigital < Number_Of_Own_Shields + 1; TheCurrentDigital++)
                    {
                        SetActiveTrue(Obj_Shield.transform.GetChild(TheCurrentDigital).gameObject);
                    }

                }
            }
            if (TypeID == (int)LaBaType.YaoPin)
            {
                if (Runbool)
                {
                    StartTheSlots();
                }
            }
            if (TypeID == (int)LaBaType.DaoZei)
            {
                TouquEnemy().Coroutine();

            }
            if (TypeID == (int)LaBaType.JinBi)
            {
                if (Runbool)
                {
                    StartTheSlots();
                }

            }
            if (TypeID == (int)LaBaType.QianDai)
            {

            }
            if (TypeID == (int)LaBaType.Null)
            {
                if (Runbool)
                {
                    StartTheSlots();
                }
            }

        }
        //延迟后两秒显示.传入需要隐藏的物体和隐藏的时间
        public async void HiddenObjects(GameObject obj, int number)
        {
            await ETModel.Game.Scene.GetComponent<TimerComponent>().WaitAsync(number);//1000是一秒
            SetActiveTrue(obj);
        }
        private bool Zhengqibool = false;

        //开始滚动
        public void BeganToTurnIt(Action fun) {
            Zhengqibool = true;
            _function = fun;
            Log.Debug("开始运行");
            if (Zhengqibool) {
                ArrIconStatus = new int[] { 1, 1, 1 };
                iArrRollCnt = new int[] { 3, 3, 3 };
                SetTheStop();
                LabaRoll();

            }
            else {
                ArrIconStatus = new int[] { 1, 1, 1 };
                iArrRollCnt = new int[] { 2, 3, 4 };
                SetTheStop();
                LabaRoll();
            }

        }

        //设置位置
        private void SetMovePosition() {
            int RollSpeed = 80;//每次移动像素
            int rollCnt = 1200 / RollSpeed;
            DicIconVector = new Dictionary<int, Vector3>();
            for (int TheCurrentDigital = 0; TheCurrentDigital <= rollCnt; TheCurrentDigital++) {
                DicIconVector.Add(720 - RollSpeed * TheCurrentDigital, new Vector3(0, (720 - RollSpeed * TheCurrentDigital) - RollSpeed, 0));
            }
            DicIconVector[-480] = new Vector3(0, 720, 0);
        }
        public async void SetTheStop()
        {
            bool isstopBool = true;
            while (isstopBool) {

                for (int TheCurrentDigital = 0; TheCurrentDigital < 3; TheCurrentDigital++) {
                    await ETModel.Game.Scene.GetComponent<TimerComponent>().WaitAsync(500);//1000是一秒
                    ArrIconStatus[TheCurrentDigital] = 2;
                }
                isstopBool = false;
                Log.Debug("设置停止的时间");
            }


        }

        //滚动
        public async void LabaRoll() {
            bool bRoll = true;
            PourTheRollBool = true;
               SetActiveTrue(Obj_LabaRotationSpecialEffect);
            AudioManagerP._instance.StopAudio(1);
            AudioManagerP._instance.PlayAudio(1, "Chouzhong_gongji_diandai");
            while (bRoll) {
                for (int TheCurrentDigital = 0; TheCurrentDigital < 3; TheCurrentDigital++) {
                    if (ArrIconStatus[TheCurrentDigital] == 1 || (ArrIconStatus[TheCurrentDigital] == 2 && iArrRollCnt[TheCurrentDigital] > 0)) {
                        for (int NumberOfSecondsNow = 0; NumberOfSecondsNow < 5; NumberOfSecondsNow++) {
                            Icons[TheCurrentDigital][NumberOfSecondsNow].localPosition = DicIconVector[(int)Icons[TheCurrentDigital][NumberOfSecondsNow].localPosition.y];
                            if ((ArrIconStatus[TheCurrentDigital] == 1 || ArrIconStatus[TheCurrentDigital] == 2) && (int)Icons[TheCurrentDigital][NumberOfSecondsNow].localPosition.y == 720 && iArrRollCnt[TheCurrentDigital] > 1) {
                                int rand = UnityEngine.Random.Range(0, 6);
                                Icons[TheCurrentDigital][NumberOfSecondsNow].GetComponent<Image>().sprite = BlurredPicture[rand];
                            }
                            else if (ArrIconStatus[TheCurrentDigital] == 2 && (int)Icons[TheCurrentDigital][NumberOfSecondsNow].localPosition.y == 720 && iArrRollCnt[TheCurrentDigital] == 1) {

                                Icons[TheCurrentDigital][NumberOfSecondsNow].GetComponent<Image>().sprite = ImgIcon[ArrIconsResult[TheCurrentDigital][NumberOfSecondsNow]];
                            }
                        }
                        if (ArrIconStatus[TheCurrentDigital] == 2 && (int)Icons[TheCurrentDigital][4].localPosition.y == -240) {
                            iArrRollCnt[TheCurrentDigital]--;
                            if (iArrRollCnt[TheCurrentDigital] == 0) ArrIconStatus[TheCurrentDigital] = 3;
                        }
                        //开始倒滚
                        if (ArrIconStatus[TheCurrentDigital] == 3 && iArrRollCnt[TheCurrentDigital] == 0) {
                            ArrIconStatus[TheCurrentDigital] = 4;
                            //  PourTheRoll(TheCurrentDigital);
                            if (TheCurrentDigital == 2)
                            {
                                bRoll = false;
                                 SetActiveFalse(Obj_LabaRotationSpecialEffect);
                                 SetActiveFalse(Obj_HitLuckyDraw);
                                AudioManagerP._instance.StopAudio(1);
                                _function();
                            }

                        }
                    }

                }
                await ETModel.Game.Scene.GetComponent<TimerComponent>().WaitAsync(0);//1000是一秒
            }
        }


        private bool PourTheRollBool = true;
        //倒滚
        public async void PourTheRoll(int TheCurrentDigital) {
            Log.Debug("开始倒滚" + TheCurrentDigital);
            ArrIconStatus[TheCurrentDigital] = 0;
            while (PourTheRollBool) {

                for (int y = -300; y <= -240; y += 10) {
                    for (int x = 0; x < 5; x++) {
                        Icons[TheCurrentDigital][x].localPosition = new Vector3(0, y + (4 - x) * 240, 0);
                    }
                    await ETModel.Game.Scene.GetComponent<TimerComponent>().WaitAsync(1);//1000是一秒
                }
            }
            if (TheCurrentDigital == 2) {
                PourTheRollBool = false;

            }
        }
        public void RangStart()
        {
            Obj_GameSlider.GetComponent<ScrollRect>().enabled = true;
               OnsetEnadlenTrue(Btn_Shop);
               OnsetEnadlenTrue(Btn_TheCard);
               OnsetEnadlenTrue(Btn_Slots);
               OnsetEnadlenTrue(Btn_Construct);
               OnsetEnadlenTrue(Btn_Bombshell);

        }
        public void RangStop()
        {
            Obj_GameSlider.GetComponent<ScrollRect>().enabled = false;
               OnsetEnadlenFalse(Btn_Shop);
               OnsetEnadlenFalse(Btn_TheCard);
               OnsetEnadlenFalse(Btn_Slots);
               OnsetEnadlenFalse(Btn_Construct);
               OnsetEnadlenFalse(Btn_Bombshell);
        }



        //匹配敌人
        private G2C_MatchMessage matchinfos;
        public async void Theenemyinformation(G2C_MatchMessage matchmessage) {
            Log.Debug("匹配敌人");
            Txt_EnemyName.text = matchmessage.NickName;
            Txt_EnemyOfGold.text = Numdispose(matchmessage.GoldCoins.ToString());
            Img_ProfilePhoto.sprite = await AccessToImage(matchmessage.FaceUrl);
            matchinfos = matchmessage;

        }
        // ImageFormat
        public async ETTask<Sprite> AccessToImage(string str) {
            Log.Debug("当前网站" + str);
            Sprite sprite = null;
            using (UnityWebRequest request = new UnityWebRequest(str)) {
                DownloadHandlerTexture downloadHandlerTexture = new DownloadHandlerTexture(true);
                request.downloadHandler = downloadHandlerTexture;
                request.SendWebRequest();
                while (!request.isDone) {
                    await ETModel.Game.Scene.GetComponent<TimerComponent>().WaitAsync(10);
                }
                if (string.IsNullOrEmpty(request.error)) {
                    Texture2D localTexture = downloadHandlerTexture.texture;
                    sprite = Sprite.Create(localTexture, new Rect(0, 0, localTexture.width, localTexture.height), new Vector2(0.5f, 0.5f));
                    return sprite;
                }
                else {

                    Debug.Log(request.error);
                }
            }
            return sprite;
        }
        private void Skipthepage1() {
            AboutSlider.Instance.Tonumberye(1);
        }
        private void Skipthepage2() {
            //AboutSlider.Instance.Tonumberye(2);
        }
        private void Skipthepage3() {
            //  AboutSlider.Instance.Tonumberye(3);
            AboutSlider.Instance.Tonumberye(2);
        }
        private void Skipthepage4() {
            //  AboutSlider.Instance.Tonumberye(4);
            if (Uicustmos == null)
            {
                UI ui = this.GetParent<UI>();
                Uicustmos = ui.GetComponent<UICustomsComponent>();
                Uicustmos.OnHuoqu();

            }
            AboutSlider.Instance.Tonumberye(3);
        }
        private void Skipthepage5() {
            // AboutSlider.Instance.Tonumberye(5);
        }
        private void OnSlCallBack(float fl) {

            AudioManagerP._instance.PlayAudio(2, "Anjian_2");
            Log.Debug("开始移动=============================" + fl);
            if (fl == 3) {
                Uicustmos.GetMaps().Coroutine();
                if (!Uicustmos.OnbenxiajiangBool)
                {
                    Uicustmos.OnBtnXiajiang();
                }

            }
            else {
                if (Uicustmos.OnbenxiajiangBool)
                {
                    Uicustmos.OnBtnXiajiang();
                }
            }


            //if (fl == 2)
            //{
            //    GetKapai().Coroutine();
            //}
            //if (fl == 5)
            //{
            //    GetFuchou().Coroutine();
            //}


            //图标 90,270,450,630,810,990
            //  -447,-267,-87,93,273,453
            //线 180  360  540  720 900
            // -357   -177  3   183   363
            switch (fl) {
                case 1:
                    TiaoShop();
                    break;
                case 2:
                    TiaoHome();

                    break;
                case 3:
                    TiaoGuanka();

                    break;

            }
            switch (fl)
            {
                //case 1:
                //    #region
                //     TiaoShop();
                //    break;
                //#endregion
                //case 2:
                //    #region
                // TiaoKapai();
                //    break;
                //#endregion
                //case 3:
                //    #region
                // TiaoHome();
                //    break;
                //#endregion
                //case 4:
                //    #region
                //TiaoGuanka();
                //    break;
                //#endregion
                //case 5:
                //    #region
                //TiaoBaofu();
                //    break;
                //    #endregion
                default:
                    break;
            }
        }

        private void TiaoShop()
        {
            Btn_Shop.GetComponent<Image>().sprite = sdda;  //修改图片
            Btn_Shop.GetComponent<Image>().SetNativeSize();
            Btn_Shop.transform.localPosition = new Vector3(-360, 40, 0);
            SetActiveTrue(Btn_Slots.gameObject);
            SetActiveFalse(Btn_HomePage.gameObject);
            Btn_Construct.GetComponent<Image>().sprite = ct; //修改图片
            Btn_Construct.GetComponent<Image>().SetNativeSize();
            SetActiveTrue(Btn_Construct.transform.GetChild(0).gameObject);
            Btn_Construct.transform.localPosition = new Vector3(370, 3, 0);


            //   SetActiveTrue(Obj_Overhead);
            //  SetActiveFalse(Obj_ConstructionOfTheSpecialEffects);
            //   SetActiveTrue(Btn_Slots.gameObject);
            // SetActiveFalse(Btn_HomePage.gameObject);
            //XianAct();
            //SetNative(sdda, Btn_Shop.GetComponent<Image>());
            //SetNative(kp, Btn_TheCard.GetComponent<Image>());
            //SetNative(zhuye, Btn_Slots.GetComponent<Image>());
            //SetNative(ct, Btn_Construct.GetComponent<Image>());
            //SetNative(cr, Btn_Bombshell.GetComponent<Image>());
            //  SetActiveFalse(xianlist[0]);
            //Btn_Shop.transform.localPosition = new Vector3(-357, 20, 0);
            //Btn_TheCard.transform.localPosition = new Vector3(-87, 0, 0);
            //Btn_Slots.transform.localPosition = new Vector3(93, 0, 0);
            //Btn_Construct.transform.localPosition = new Vector3(273, 0, 0);
            //Btn_Bombshell.transform.localPosition = new Vector3(453, 0, 0);
        }

        private void TiaoKapai()
        {

                    SetActiveFalse(Obj_Overhead);
                    SetActiveFalse(Obj_ConstructionOfTheSpecialEffects);
               SetActiveTrue(Btn_Slots.gameObject);
                 SetActiveFalse(Btn_HomePage.gameObject);
            XianAct();
            SetNative(kpda, Btn_TheCard.GetComponent<Image>());
            SetNative(sd, Btn_Shop.GetComponent<Image>());
            SetNative(zhuye, Btn_Slots.GetComponent<Image>());
            SetNative(ct, Btn_Construct.GetComponent<Image>());
            SetNative(cr, Btn_Bombshell.GetComponent<Image>());
                  SetActiveFalse(xianlist[1]);
            Btn_TheCard.transform.localPosition = new Vector3(-177, 20, 0);
            Btn_Shop.transform.localPosition = new Vector3(-477, 0, 0);
            Btn_Slots.transform.localPosition = new Vector3(93, 0, 0);
            Btn_Construct.transform.localPosition = new Vector3(273, 0, 0);
            Btn_Bombshell.transform.localPosition = new Vector3(453, 0, 0);

        }

        private void TiaoHome()
        {
                   SetActiveFalse(Btn_Slots.gameObject);
             SetActiveTrue(Btn_HomePage.gameObject);
            Btn_Shop.GetComponent<Image>().sprite = sd;    //修改图片
            Btn_Shop.GetComponent<Image>().SetNativeSize();
            Btn_Shop.transform.localPosition = new Vector3(-360, 3, 0);
            Btn_Construct.GetComponent<Image>().sprite = ct;    //修改图片
            Btn_Construct.GetComponent<Image>().SetNativeSize();
              SetActiveTrue(Btn_Construct.transform.GetChild(0).gameObject);
            Btn_Construct.transform.localPosition = new Vector3(370, 3, 0);
            //           SetActiveFalse(Btn_Slots.gameObject );
            //     SetActiveTrue(Btn_HomePage.gameObject);
            //     SetActiveTrue(Obj_Overhead);
            //            SetActiveFalse(ConstructionOfTheSpecialEffects);
            //XianAct();
            //SetNative(sd, Btn_Shop.GetComponent<Image>());
            //SetNative(kp, Btn_TheCard.GetComponent<Image>());
            //SetNative(ct, Btn_Construct.GetComponent<Image>());
            //SetNative(cr, Btn_Bombshell.GetComponent<Image>());
            //           SetActiveFalse( xianlist[2]);
            //    Btn_Shop.transform.localPosition = new Vector3(-447, 0, 0);
            //    Btn_TheCard.transform.localPosition = new Vector3(-267, 0, 0);
            //    Btn_Construct.transform.localPosition = new Vector3(273, 0, 0);
            //    Btn_Bombshell.transform.localPosition = new Vector3(453, 0, 0);
        }

        private void TiaoGuanka()
        {
            Btn_Construct.GetComponent<Image>().sprite = ctda;   //修改图片
            Btn_Construct.GetComponent<Image>().SetNativeSize();
            Btn_Construct.transform.localPosition = new Vector3(370, 40, 0);
              SetActiveTrue(Btn_Slots.gameObject);
                    SetActiveFalse(Btn_HomePage.gameObject);
            Btn_Shop.GetComponent<Image>().sprite = sd;     //修改图片
                  SetActiveFalse(Btn_Construct.transform.GetChild(0).gameObject);
            Btn_Shop.GetComponent<Image>().SetNativeSize();
            Btn_Shop.transform.localPosition = new Vector3(-360, 3, 0);



            //       SetActiveTrue(Btn_Slots.gameObject);
            //        SetActiveFalse(Btn_HomePage.gameObject);
            //      SetActiveTrue(Obj_Overhead);
            //          SetActiveFalse Obj_ConstructionOfTheSpecialEffects );
            //XianAct();
            //SetNative(ctda, Btn_Construct.GetComponent<Image>());
            //SetNative(sd, Btn_Shop.GetComponent<Image>());
            //SetNative(zhuye, Btn_Slots.GetComponent<Image>());
            //SetNative(kp, Btn_TheCard.GetComponent<Image>());
            //SetNative(cr, Btn_Bombshell.GetComponent<Image>());
            //           SetActiveFalse(xianlist[3] );
            //    Btn_Construct.transform.localPosition = new Vector3(183, 20, 0);
            //    Btn_Shop.transform.localPosition = new Vector3(-447, 0, 0);
            //    Btn_TheCard.transform.localPosition = new Vector3(-267, 0, 0);
            //    Btn_Slots.transform.localPosition = new Vector3(-87, 0, 0);
            //    Btn_Bombshell.transform.localPosition = new Vector3(453, 0, 0);
        }

        private void TiaoBaofu()
        {

                    SetActiveFalse(Obj_Overhead);
                    SetActiveFalse(Obj_ConstructionOfTheSpecialEffects);
               SetActiveTrue(Btn_Slots.gameObject);
               SetActiveFalse(Btn_HomePage.gameObject);
            XianAct();
            SetNative(crda, Btn_Bombshell.GetComponent<Image>());
            SetNative(sd, Btn_Shop.GetComponent<Image>());
            SetNative(zhuye, Btn_Slots.GetComponent<Image>());
            SetNative(kp, Btn_TheCard.GetComponent<Image>());
            SetNative(ct, Btn_Construct.GetComponent<Image>());
               SetActiveFalse(xianlist[4]);
            Btn_Bombshell.transform.localPosition = new Vector3(363, 20, 0);
            Btn_Shop.transform.localPosition = new Vector3(-447, 0, 0);
            Btn_TheCard.transform.localPosition = new Vector3(-267, 0, 0);
            Btn_Slots.transform.localPosition = new Vector3(-87, 0, 0);
            Btn_Construct.transform.localPosition = new Vector3(93, 0, 0);

        }

        private void XianAct()
        {
            for (int TheCurrentDigital = 0; TheCurrentDigital < xianlist.Count; TheCurrentDigital++)
            {
                   SetActiveTrue(xianlist[TheCurrentDigital]);

            }
        }
        private void SetNative(Sprite spritr, Image imgs)
        {
            imgs.sprite = ct;   //修改图片
            imgs.SetNativeSize();
        }
        //攻击之前获取敌人信息
        private bool attacling;
        private List<int> jianzhulvlist = new List<int>();//打之前的建筑物等级.打完之后判断是否消失还是存在显示特效
        private int ditulv;//打之前的地图等级
        private async ETVoid GetEnemyInfo()
        {
            try
            {
                G2C_GetEnemyInfo g2GetEnemyInfo = (G2C_GetEnemyInfo)await SessionComponent.Instance.Session.Call(new C2G_GetEnemyInfo());//发送消息收到回调
                if (g2GetEnemyInfo.Error != ErrorCode.ERR_Success)
                {
                    Log.Debug(g2GetEnemyInfo.Message);
                    return;
                }
                Log.Debug("成功获得回调");
                Log.Debug("成功获得回调" + matchinfos.NickName);
                Log.Debug("成功获得回调" + Txt_NameOfAttack.name);
                if (Uicustmos == null)
                {
                    UI ui = this.GetParent<UI>();
                    Uicustmos = ui.GetComponent<UICustomsComponent>();
                    Uicustmos.OnHuoqu();

                }
                Txt_NameOfAttack.text = matchinfos.NickName;
                Img_AttackedAvatar.sprite = await AccessToImage(matchinfos.FaceUrl);
                SetActiveTrue(Obj_AttacksOnPage);
                SetActiveFalse(Obj_CompletionOfAttack);
                SetActiveTrue(Btn_RevengeOnTheEnemy.gameObject);
                SetActiveTrue(Obj_AttackOnback.gameObject);
                AudioManagerP._instance.PlayBGMAudio("GongjiBGM1");
                Attackanimator.SetBool("Attackbool", false);
                SetActiveFalse(Artillery_effects.transform.GetChild(1).gameObject);
                HiddenObjects(Artillery_effects, 1000);
                jianzhulvlist.Clear();
                for (int TheCurrentDigital = 1; TheCurrentDigital < 6; TheCurrentDigital++)
                {
                    SetActiveFalse(Obj_AttacksOnPage.transform.Find("Number_" + TheCurrentDigital).transform.GetChild(2).gameObject);

                }
                Xiuspr(g2GetEnemyInfo);
                ditulv = g2GetEnemyInfo.Level + 1;
                if (g2GetEnemyInfo.Levs[0] == 0 && g2GetEnemyInfo.Levs[1] == 0 && g2GetEnemyInfo.Levs[2] == 0 && g2GetEnemyInfo.Levs[3] == 0 && g2GetEnemyInfo.Levs[4] == 0)
                {
                    attacling = true;
                    SetActiveTrue(Obj_AgainstTheSpecialEffects);
                    SetActiveTrue(Obj_AgainstTheSpecialEffects.transform.GetChild(2).gameObject);
                    HiddenObjects(Obj_AgainstTheSpecialEffects.transform.GetChild(0).gameObject, 1000);

                }
                else
                {
                    SetActiveFalse(Obj_AgainstTheSpecialEffects);
                    for (int i = 0; i < 3; i++)
                    {
                        SetActiveFalse(Obj_AgainstTheSpecialEffects.transform.GetChild(i).gameObject);
                    }
                }
                Txt_DescriptionOfAttack.text = "地图等级" + (g2GetEnemyInfo.Level + 1);

            }
            catch (Exception e)
            {

                Log.Error(e);
            }
        }
        private void Xiuspr(G2C_GetEnemyInfo g2GetEnemyInfo)
        {
            for (int TheCurrentDigital = 0; TheCurrentDigital < 5; TheCurrentDigital++)
            {
                if (g2GetEnemyInfo.Levs[TheCurrentDigital] > 0)//如果当前等级大于零 显示当前等级的图片
                {
                    //  Log.Debug("地图等级:" + (g2GetEnemyInfo.Level + 1) + "    当前等级" + (g2GetEnemyInfo.Levs[TheCurrentDigital]) + "   TheCurrentDigital="+ (TheCurrentDigital + 1));
                  //  Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetComponent<Image>().sprite = Uicustmos.CheckpointsResources.Get<Sprite>((g2GetEnemyInfo.Level + 1) + "_" + (g2GetEnemyInfo.Levs[TheCurrentDigital]) + "_" + (TheCurrentDigital + 1));
                    Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetComponent<Image>().sprite = Uicustmos.CheckpointsResources.Get<Sprite>( "1_" + (g2GetEnemyInfo.Levs[TheCurrentDigital]) + "_" + (TheCurrentDigital + 1));
                    Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetComponent<Image>().SetNativeSize();
                    SetColorQuan(Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetComponent<Image>());
                    HiddenObjects(Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetChild(0).gameObject, 1000);
                    SetActiveTrue(Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetChild(1).gameObject);
                    SetActiveFalse(Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetChild(2).gameObject);
                }
                else
                {
                    SetColoKong(Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetComponent<Image>());
                }

                if (g2GetEnemyInfo.MaxLevs[TheCurrentDigital] > g2GetEnemyInfo.Levs[TheCurrentDigital])//被攻击了的建筑物.显示被攻击特效
                {
                    SetActiveTrue(Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetChild(3).gameObject);

                }
                jianzhulvlist.Add(g2GetEnemyInfo.Levs[TheCurrentDigital]);
            }
        }
        private void SetColorQuan(Image img)
        {
            img.color = new Color(1, 1, 1, 1);
        }
        private void SetColoKong(Image img)
        {
            img.color = new Color(1, 1, 1, 0.01f);
        }
        public void SetActiveTrue(GameObject obj)
        {
            obj.SetActive(true);
        }
        public void SetActiveFalse(GameObject obj)
        {
            obj.SetActive(false);
        }
        //开始攻击
        private void Startatt(int value)
        {
            Log.Debug("获得的点" + value);
            StartAttack(value).Coroutine();
        }

        private void OnAttackItem()
        {
            SetActiveFalse(Obj_AttacksOnPage);
            SetActiveTrue(Obj_Attackfuchou);
            Obj_Attackfuchou.transform.localScale = new Vector3(1, 1, 1);

        }

        private bool DirenHudunbool = false;
        private async ETVoid StartAttack(int value) {
            try {
                Log.Debug("发送得点是" + value);
                C2G_AttackEnemy attackenemy = new C2G_AttackEnemy();
                attackenemy.Index = value;
                G2C_AttackEnemy g2Attacjenemy = (G2C_AttackEnemy)await SessionComponent.Instance.Session.Call(attackenemy);//发送消息收到回调
                if (g2Attacjenemy.Error != ErrorCode.ERR_Success) {
                    return;
                }
                if (g2Attacjenemy.HuDun == 0) {
                    DirenHudunbool = false;
                }
                else {
                    DirenHudunbool = true;
                }
                for (int TheCurrentDigital = 0; TheCurrentDigital < 5; TheCurrentDigital++) {
                    SetActiveFalse(Obj_AttacksOnPage.transform.GetChild(TheCurrentDigital).GetChild(1).gameObject);
                }
                SetActiveFalse(Obj_AgainstTheSpecialEffects.transform.GetChild(2).gameObject);
                Attackasync(value, g2Attacjenemy.GoldCoins);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }

        }
        public async void Attackasync(int value, long AttckGoid)
        {
            float Dadian = 1;
            for (int TheCurrentDigital = 0; TheCurrentDigital < 10; TheCurrentDigital++) {
                Dadian -= 0.1f;
                for (int NumberOfSecondsNow = 0; NumberOfSecondsNow < 5; NumberOfSecondsNow++) {
                    Obj_AttacksOnPage.transform.GetChild(NumberOfSecondsNow).GetChild(0).localScale = new Vector3(Dadian, Dadian, 1);
                    if (attacling) {
                        Obj_AgainstTheSpecialEffects.transform.GetChild(0).localScale = new Vector3(Dadian, Dadian, 1);
                    }
                }
                await ETModel.Game.Scene.GetComponent<TimerComponent>().WaitAsync(50);
            }
            for (int TheCurrentDigital = 0; TheCurrentDigital < 5; TheCurrentDigital++) {
                SetActiveFalse(Obj_AttacksOnPage.transform.GetChild(TheCurrentDigital).GetChild(0).gameObject);
                Obj_AttacksOnPage.transform.GetChild(TheCurrentDigital).GetChild(0).localScale = new Vector3(1, 1, 1);
            }
            SetActiveFalse(Obj_AgainstTheSpecialEffects.transform.GetChild(0).gameObject);
            Obj_AgainstTheSpecialEffects.transform.GetChild(0).localScale = new Vector3(1, 1, 1);
            Attackanimator.SetBool("Attackbool", true);
            await ETModel.Game.Scene.GetComponent<TimerComponent>().WaitAsync(180);//1000是一秒
            SetActiveTrue(Artillery_effects.transform.GetChild(1).gameObject);
            await ETModel.Game.Scene.GetComponent<TimerComponent>().WaitAsync(500);//1000是一秒g
            SetActiveFalse(Artillery_effects.transform.GetChild(1).gameObject);
            SetActiveTrue(Obj_AgainstTheSpecialEffects.transform.GetChild(1).gameObject);
            jianzhulvlist[value] -= 1;
            if (DirenHudunbool) {
                AudioManagerP._instance.PlayAudio(1, "Dunpaidangzhugongji");
                //对方有没有护盾
                SetActiveTrue(Obj_AttacksOnPage.transform.Find("Obj_Hudunchuxian").gameObject);
                await ETModel.Game.Scene.GetComponent<TimerComponent>().WaitAsync(1000);//1000是一秒
            }
            else {
                AudioManagerP._instance.PlayAudio(1, "Gongji_paodanbaozha1");
                SetActiveTrue(Obj_AttacksOnPage.transform.Find("Number_" + (value + 1)).transform.GetChild(2).gameObject);
                await ETModel.Game.Scene.GetComponent<TimerComponent>().WaitAsync(1500);//1000是一秒
            }
            SetActiveFalse(Artillery_effects.gameObject);

            if (jianzhulvlist[value] <= 0) {
                SetColoKong(Obj_AttacksOnPage.transform.Find("Number_" + (value + 1)).GetComponent<Image>());
                SetActiveTrue(Obj_AttacksOnPage.transform.Find("Number_" + (value + 1)).GetChild(3).gameObject);
            }
            else
            {
                Obj_AttacksOnPage.transform.Find("Number_" + (value + 1)).GetComponent<Image>().sprite = Uicustmos.CheckpointsResources.Get<Sprite>(ditulv + "_" + jianzhulvlist[value] + "_" + (value + 1));
                SetActiveTrue(Obj_AttacksOnPage.transform.Find("Number_" + (value + 1)).GetChild(3).gameObject);
            }
            Number_Of_Gold_COINS += AttckGoid;
            Txt_HisGoldCOINS.text = Numdispose(Number_Of_Gold_COINS.ToString());
            SetActiveFalse(Obj_AgainstTheSpecialEffects.transform.GetChild(1).gameObject);
            Txt_DescribeTheEnd.text = "在攻击中获得了<color=#D9D919><size=60>" + Numdispose(AttckGoid.ToString()) + "</size></color>金币<color=#8E236B><size=60>是别人家的</size></color>";
            SetActiveFalse(Obj_AttackOnback);
            SetActiveTrue(Obj_CompletionOfAttack);
        }
        private void AttackOver() {
            SetActiveTrue(Obj_Interlude);
            HiddenObjects(Obj_Interlude, 1000);
            SetActiveFalse(Obj_AttacksOnPage);
            AudioManagerP._instance.PlayBGMAudio("BGM1");
            if (Runbool)
            {
                StartTheSlots();
            }
        }


        //偷取之前获取敌人信息
        private long TouquGoidInt = 0;
        private int TouquNumber = 0;
        private async ETVoid TouquEnemy() {
            try {
                G2C_GetEnemyInfo g2GetEnemyInfo = (G2C_GetEnemyInfo)await SessionComponent.Instance.Session.Call(new C2G_GetEnemyInfo());//发送消息收到回调
                if (g2GetEnemyInfo.Error != ErrorCode.ERR_Success) {
                    Log.Debug(g2GetEnemyInfo.Message);
                    return;
                }
                AudioManagerP._instance.PlayBGMAudio("TouxiBgm");
                Txt_NameStolen.text = matchinfos.NickName;
                Txt_StealingGoldCOINS.text = Numdispose(matchinfos.GoldCoins.ToString());
                Img_StolenHeads.sprite = await AccessToImage(matchinfos.FaceUrl);
                Log.Debug("偷取获取信息成功");
                SetActiveTrue(Obj_Steal);
                SetActiveTrue(Obj_StealInformationBack);
                SetActiveFalse(Obj_StealTheSettlement);
                TouquNumber = 3;
                TouquGoidInt = 0;
                Txt_StealManStar.text = TouquGoidInt.ToString();
                TouquFinfo(g2GetEnemyInfo);
            }
            catch (Exception e) {
                Log.Error(e);
            }
        }

        private void TouquFinfo(G2C_GetEnemyInfo g2GetEnemyInfo) 
        {

            for (int TheCurrentDigital = 0; TheCurrentDigital < 5; TheCurrentDigital++)
            {

                Log.Debug("地图等级:" + (g2GetEnemyInfo.Level + 1) + "    当前等级" + (g2GetEnemyInfo.Levs[TheCurrentDigital] + 1) + "   TheCurrentDigital=" + (TheCurrentDigital + 1));
                if (g2GetEnemyInfo.Levs[TheCurrentDigital] <= 0)
                {
                    Obj_Steal.transform.Find("Number_" + (TheCurrentDigital + 1)).GetComponent<Image>().color = new Color(1, 1, 1, 0.01f);
                }
                else
                {
                    Obj_Steal.transform.Find("Number_" + (TheCurrentDigital + 1)).GetComponent<Image>().sprite = Uicustmos.CheckpointsResources.Get<Sprite>((1) + "_" + (g2GetEnemyInfo.Levs[TheCurrentDigital]) + "_" + (TheCurrentDigital + 1));
                    Obj_Steal.transform.Find("Number_" + (TheCurrentDigital + 1)).GetComponent<Image>().SetNativeSize();
                    Obj_Steal.transform.Find("Number_" + (TheCurrentDigital + 1)).GetComponent<Image>().color = new Color(1, 1, 1, 1);

                }
                if (g2GetEnemyInfo.MaxLevs[TheCurrentDigital] <= g2GetEnemyInfo.Levs[TheCurrentDigital])
                {
                          SetActiveFalse(Obj_Steal.transform.Find("Number_" + (TheCurrentDigital + 1)).transform.GetChild(0).gameObject);
                }
                else
                {
                      SetActiveTrue(Obj_Steal.transform.Find("Number_" + (TheCurrentDigital + 1)).transform.GetChild(0).gameObject);//判断当前建筑物是否被攻击过
                }
                if (TheCurrentDigital < 4)
                {
                      SetActiveTrue(Obj_Steal.transform.Find("Tou" + TheCurrentDigital).gameObject);//可攻击图标
                      OnsetEnadlenTrue(Obj_Steal.transform.Find("Tou" + TheCurrentDigital).GetComponent<Button>());
                }
            }
        }
        private void Starttq(int value){
               OnsetEnadlenFalse(Obj_Steal.transform.Find("Tou" + value).GetComponent<Button>());
                  SetActiveFalse(Txt_StealThePrompt.gameObject);
            Log.Debug("发送偷取信息"+value);
            StartTouqu(value).Coroutine();
        }
        private async ETVoid StartTouqu(int value){
                try{
              
                C2G_StealEnemy touquenemy = new C2G_StealEnemy();
                touquenemy.Index = value;
                G2C_StealEnemy g2Attacjenemy = (G2C_StealEnemy)await SessionComponent.Instance.Session.Call(touquenemy);//发送消息收到回调
                   if (g2Attacjenemy.Error != ErrorCode.ERR_Success) {
                    SetActiveTrue(Txt_StealThePrompt.gameObject);
                    Txt_StealThePrompt.text = g2Attacjenemy.Message;
                    SetActiveFalse(Obj_Steal.transform.Find("Tou" + value).gameObject);
                    Log.Debug(g2Attacjenemy.Message);
                    return;
                    }
                AudioManagerP._instance.PlayAudio(1, "TouxiChenggong_huodeyidian");
                SetActiveFalse(Obj_Steal.transform.Find("Tou" + value).gameObject);
                TouquGoidInt += g2Attacjenemy.GoldCoins;
                Txt_StealManStar.text = Numdispose(TouquGoidInt.ToString());
                TouquNumber--;
                Log.Debug("偷取的金币" + g2Attacjenemy.GoldCoins + "剩下的次数" + TouquNumber);
                if (TouquNumber==0){
                    AudioManagerP._instance.PlayAudio(1, "TouxiChenggong_huodequanbu");
                    SetActiveFalse(Obj_StealInformationBack);
                    Txt_StealSettlementDescription.text = "在偷取中获得了<color=#FDC423><size=60>" + Numdispose(TouquGoidInt.ToString()) + "</size></color>金币<color=#8E236B><size=60>是别人家的</size></color>";
                    SetActiveTrue(Obj_StealTheSettlement);
                    for (int TheCurrentDigital = 0; TheCurrentDigital < 4; TheCurrentDigital++){
                        SetActiveFalse(Obj_Steal.transform.Find("Tou" + TheCurrentDigital).gameObject);
                    }
                     Number_Of_Gold_COINS += TouquGoidInt;
                    Txt_HisGoldCOINS.text = Numdispose( Number_Of_Gold_COINS.ToString());
                }
                //g2Attacjenemy.GoldCoins  ;//偷得的金币 
            }
            catch (Exception e)
                {
                    Log.Error(e);
                }

            }
        private void TouquOver()
        {
            HiddenObjects(Obj_Interlude, 1000);
            AudioManagerP._instance.PlayBGMAudio("BGM1");
            SetActiveFalse(Obj_Steal);
            SetActiveTrue(Obj_Interlude);
            if (Runbool){
                StartTheSlots();
            }
        }

        #endregion;





        #region//复仇
        private G2C_RevengeList revenglist;
        private G2C_RevengeList attackrevenglist;
        //获取复仇列表
        public async ETVoid GetFuchou()
        {
            try
            {
                G2C_RevengeList g2revengelist = (G2C_RevengeList)await SessionComponent.Instance.Session.Call(new C2G_RevengeList());//发送消息收到回调
                if (g2revengelist.Error != ErrorCode.ERR_Success) //不成功
                {
                    Log.Debug(g2revengelist.Message);
                    return;
                }
                if (g2revengelist.Lists.count<=0){
                      OnsetEnadlenTrue(Btn_RevengeOnTheEnemy);
                    Btn_RevengeOnTheEnemy.GetComponent<Image>().material = ShaderFei;
                }
                else{
                       OnsetEnadlenTrue(Btn_RevengeOnTheEnemy);
                    Btn_RevengeOnTheEnemy.GetComponent<Image>().material = null;

                }
                SetScoroll(g2revengelist);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
        public void OnsetEnadlenTrue(Button Onbutton) 
        {
            Onbutton.GetComponent<Button>().enabled = true;
        }
        public void OnsetEnadlenFalse(Button Onbutton)
        {
            Onbutton.GetComponent<Button>().enabled = false;
        }
       
        private void SetScoroll(G2C_RevengeList g2revengelist)
        {
            revenglist = g2revengelist;
            attackrevenglist = g2revengelist;
            ScrollViewEx sve = Obj_RevengeList.GetComponent<ScrollViewEx>();
            ScrollViewEx attacksve = Obj_Attacfuchouliebiao.GetComponent<ScrollViewEx>();
            sve.SetDataCount(g2revengelist.Lists.count);
            attacksve.SetDataCount(g2revengelist.Lists.count);
            sve.OnSetItem = OnsetItem;
            attacksve.OnSetItem = OnsetAttackItem;
            sve.ReSetScrollView();
            attacksve.ReSetScrollView();

        }
        private void OnsetItem(Transform tranforms,int items) 
        {
            tranforms.Find("Txt_NameEsp").GetComponent<Text>().text = revenglist.Lists[items].NickName;
            tranforms.Find("Img_ProfilePhotok/Image1/Txt_xinxinmunber").GetComponent<Text>().text = revenglist.Lists[items].Lev.ToString();
            FuchouEnemy(tranforms.Find("Img_ProfilePhotok/touxiangkuang/Image").GetComponent<Image>(), revenglist.Lists[items].FaceUrl);
            tranforms.localScale = new Vector3(1, 1, 1);
            SetActiveTrue(tranforms.gameObject);
        }

        //攻击里面的复仇列表
        private void OnsetAttackItem(Transform tranforms, int items)
        {
            Log.Debug("攻击里面复仇列表;;;=================" + items);
            tranforms.Find("Img_ProfilePhotok/Image1/Txt_xinxinmunber").GetComponent<Text>().text = revenglist.Lists[items].Lev.ToString();
            tranforms.Find("Txt_direnname").GetComponent<Text>().text = revenglist.Lists[items].NickName;
            FuchouEnemy(tranforms.Find("Img_ProfilePhotok/touxiangkuang/Image").GetComponent<Image>(), revenglist.Lists[items].FaceUrl);
            tranforms.localScale = new Vector3(1, 1, 1);
            SetActiveTrue(tranforms.gameObject);
            RevengeInfo info = attackrevenglist.Lists[items];
            tranforms.transform.Find("Button").GetComponent<Button>().onClick.RemoveAllListeners();
            tranforms.transform.Find("Button").GetComponent<Button>().onClick.Add(() => { Attackfuchoubtn(info); });
        }
        public async void FuchouEnemy(Image touxiangimg, string touxiangstr)
        {
            touxiangimg.sprite = await AccessToImage(touxiangstr);
        }

        private void Attackfuchoubtn(RevengeInfo info) 
        {
            Getfuchouattackinfo(info).Coroutine();


        }
        private async ETVoid Getfuchouattackinfo(RevengeInfo info)
        {
            try
            {
                C2G_GetRevengeInfo getrevange = new C2G_GetRevengeInfo();
                getrevange.UserID = info.UserID;
                   G2C_GetRevengeInfo Getrevengeinfo = (G2C_GetRevengeInfo)await SessionComponent.Instance.Session.Call(getrevange);//发送消息收到回调
                if (Getrevengeinfo.Error != ErrorCode.ERR_Success) //不成功
                {
                    Log.Debug(Getrevengeinfo.Message);
                    return;
                }
                    Log.Debug("成功获得回调");
                    Txt_NameOfAttack.text = info.NickName;
                          SetActiveFalse(Obj_Attackfuchou);

                for (int TheCurrentDigital = 1; TheCurrentDigital < 6; TheCurrentDigital++)
                {
                          SetActiveFalse(Obj_AttacksOnPage.transform.Find("Number_" + TheCurrentDigital).transform.GetChild(2).gameObject);
                }
                          SetActiveFalse(Btn_RevengeOnTheEnemy.gameObject);
                    Img_AttackedAvatar.sprite = await AccessToImage(info.FaceUrl);
                      SetActiveTrue(Obj_AttacksOnPage);
                         SetActiveFalse(Obj_CompletionOfAttack);
                  SetActiveTrue(Obj_AttackOnback);
                    Attackanimator.SetBool("Attackbool", false);
                        SetActiveFalse(Artillery_effects.transform.GetChild(1).gameObject);
                    HiddenObjects(Artillery_effects, 1000);
                    jianzhulvlist.Clear();
                    Huodeinfosje(Getrevengeinfo);
                    ditulv = Getrevengeinfo.Level++;
                    if (Getrevengeinfo.Levs[0] == 0 && Getrevengeinfo.Levs[1] == 0 && Getrevengeinfo.Levs[2] == 0 && Getrevengeinfo.Levs[3] == 0 && Getrevengeinfo.Levs[4] == 0)
                    {
                        attacling = true;
                          SetActiveTrue(Obj_AgainstTheSpecialEffects);
                        HiddenObjects(Obj_AgainstTheSpecialEffects.transform.GetChild(0).gameObject, 1000);
                           SetActiveTrue(Obj_AgainstTheSpecialEffects.transform.GetChild(2).gameObject);
                    }
                    else
                    {
                         SetActiveFalse(Obj_AgainstTheSpecialEffects);
                         for (int i = 0; i < 3; i++)
                         {
                                   SetActiveFalse(Obj_AgainstTheSpecialEffects.transform.GetChild(i).gameObject);
                         }
                    }
                    Txt_DescriptionOfAttack.text = "地图等级" + (Getrevengeinfo.Level + 1);
                    return;
                
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }

        private void Huodeinfosje(G2C_GetRevengeInfo Getrevengeinfo ) 
        {
            for (int TheCurrentDigital = 0; TheCurrentDigital < 5; TheCurrentDigital++)
            {
                if (Getrevengeinfo.Levs[TheCurrentDigital] > 0)
                {
                    //  Log.Debug("地图等级:" + (g2GetEnemyInfo.Level + 1) + "    当前等级" + (g2GetEnemyInfo.Levs[TheCurrentDigital]) + "   TheCurrentDigital="+ (TheCurrentDigital + 1));
                    Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetComponent<Image>().sprite = Uicustmos.CheckpointsResources.Get<Sprite>((Getrevengeinfo.Level + 1) + "_" + (Getrevengeinfo.Levs[TheCurrentDigital]) + "_" + (TheCurrentDigital + 1));
                    Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetComponent<Image>().SetNativeSize();
                    Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetComponent<Image>().color = new Color(1, 1, 1, 1); ;
                    HiddenObjects(Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetChild(0).gameObject, 1000);
                    SetActiveTrue(Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetChild(1).gameObject);
                    SetActiveFalse(Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetChild(2).gameObject);
                }
                else
                {
                    Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetComponent<Image>().color = new Color(1, 1, 1, 0.01f); ;
                }
                if (Getrevengeinfo.MaxLevs[TheCurrentDigital] > Getrevengeinfo.Levs[TheCurrentDigital])//被攻击了的建筑物.显示被攻击特效
                {
                    SetActiveTrue(Obj_AttacksOnPage.transform.Find("Number_" + (TheCurrentDigital + 1)).GetChild(3).gameObject);
                }
                jianzhulvlist.Add(Getrevengeinfo.Levs[TheCurrentDigital]);
            }
        }
        public void OnsetMessage(G2C_NoticeMessage notice) 
        {
            if (Uimoreoptions == null)
            {
                UI ui = this.GetParent<UI>();
                Uimoreoptions = ui.GetComponent<UIMoreOptionsComponent>();
                Uimoreoptions.Awake();

            }
            else
            {
                Uimoreoptions.OnsetMessage(notice);
            }
        }

        private void OnBtnRUnMore()
        {
            if (Uimoreoptions == null) 
            {
                UI ui = this.GetParent<UI>();
                Uimoreoptions = ui.GetComponent<UIMoreOptionsComponent>();
                Uimoreoptions.Awake();
          
            }
            else
            {
                  SetActiveTrue(Uimoreoptions.Obj_MoreOptions);

            }
           
        }
        #endregion


        #region//卡牌
        //获取卡牌
        private G2C_GetCardPackage ardpackage;
        private async ETVoid GetKapai()
        {
            try
            {
                G2C_GetCardPackage getcardpackage = (G2C_GetCardPackage)await SessionComponent.Instance.Session.Call(new C2G_GetCardPackage());//发送消息收到回调
                if (getcardpackage.Error != ErrorCode.ERR_Success) //不成功
                {
                    Log.Debug("==========================不成功");
                    return;
                }
                Log.Debug("==============卡牌成功:"+ kapaiguankalist.Count);
                int numbers = 4;
                int numtwo = 0;
                ardpackage = getcardpackage;
                for (int TheCurrentDigital = 0; TheCurrentDigital < kapaiguankalist.Count; TheCurrentDigital++)
                {
                    numtwo = 0;
                    numbers += 2;
                    if (TheCurrentDigital< getcardpackage.Info.Count)
                    {
                      
                        kapaiguankalist[TheCurrentDigital].Find("hongdai/Text").GetComponent<Text>().text = "关卡名字";
                          OnsetEnadlenTrue(kapaiguankalist[TheCurrentDigital].GetComponent<Button>());
                        for (int NumberOfSecondsNow = 0; NumberOfSecondsNow < getcardpackage.Info[TheCurrentDigital].Count.count; NumberOfSecondsNow++)
                        {
                            if (getcardpackage.Info[TheCurrentDigital].Count[NumberOfSecondsNow]>0)
                            {
                                numtwo++;
                            }
                        }
                        if (numtwo < 9)
                        {
                            kapaiguankalist[TheCurrentDigital].Find("Image/Image").GetComponent<Image>().fillAmount = (numtwo * 0.11f);
                        }
                        else
                        {
                            kapaiguankalist[TheCurrentDigital].Find("Image/Image").GetComponent<Image>().fillAmount = 1;
                        }
                        kapaiguankalist[TheCurrentDigital].Find("Image/Text").GetComponent<Text>().text = numtwo + "/9";
                              SetActiveFalse(kapaiguankalist[TheCurrentDigital].Find("Suo").gameObject);
                        //  kapaiguankalist[TheCurrentDigital].Find("Img_tubiao").GetComponent<Image>().sprite = CardResources.Get<Sprite>(guankaint+"-0");
                        kapaiguankalist[TheCurrentDigital].Find("Img_tubiao").GetComponent<Image>().sprite = CardResources.Get<Sprite>("1-0");
                      SetActiveTrue(kapaiguankalist[TheCurrentDigital].Find("Img_tubiao").gameObject);
                    }
                    else
                    {
                    
                        kapaiguankalist[TheCurrentDigital].Find("hongdai/Text").GetComponent<Text>().text = "第" + numbers + "关解锁";
                        kapaiguankalist[TheCurrentDigital].Find("Image/Text").GetComponent<Text>().text = "未解锁";
                          SetActiveTrue(kapaiguankalist[TheCurrentDigital].Find("Suo").gameObject);
                       OnsetEnadlenFalse(kapaiguankalist[TheCurrentDigital].GetComponent<Button>());
                    }
                }
            }
            catch (Exception e)
            {
                Log.Debug("==============!成功");
                Log.Error(e);
            }
        }

        private void SetOnkapai(int value  ) //点击卡包显示卡片弹窗
        {
            Log.Debug("当前第几卡牌" + value);
            for (int TheCurrentDigital = 0; TheCurrentDigital < CardParentObject.transform.childCount; TheCurrentDigital++)
            {
                //  CardParentObject.transform.GetChild(TheCurrentDigital).GetComponent<Image>().sprite = CardResources.Get<Sprite>(value+"-"+(TheCurrentDigital+1));
                CardParentObject.transform.GetChild(TheCurrentDigital).GetComponent<Image>().sprite = CardResources.Get<Sprite>("1" + "-" + (TheCurrentDigital + 1));
                CardParentObject.transform.GetChild(TheCurrentDigital).GetComponent<Image>().material = ShaderFei;
                   OnsetEnadlenFalse(CardParentObject.transform.GetChild(TheCurrentDigital).GetComponent<Button>());
                      SetActiveFalse(CardParentObject.transform.GetChild(TheCurrentDigital).GetChild(0).gameObject);
            }
            for (int TheCurrentDigital = 0; TheCurrentDigital < ardpackage.Info[value].Count.count; TheCurrentDigital++)
            {
                Log.Debug("当前数字卡牌" + TheCurrentDigital + "       ====== " + ardpackage.Info[value].Count[TheCurrentDigital]);
                if (ardpackage.Info[value].Count[TheCurrentDigital]>0)
                {
            
                    CardParentObject.transform.GetChild(TheCurrentDigital).GetComponent<Image>().material = null;
                      OnsetEnadlenTrue(CardParentObject.transform.GetChild(TheCurrentDigital).GetComponent<Button>());
                    CardParentObject.transform.GetChild(TheCurrentDigital).GetChild(0).GetComponent<Text>().text = ardpackage.Info[value].Count[TheCurrentDigital].ToString();
                    SetActiveTrue(CardParentObject.transform.GetChild(TheCurrentDigital).GetChild(0).gameObject);
                    CardParentObject.transform.GetChild(TheCurrentDigital).GetComponent<Button>().onClick.RemoveAllListeners();
                    int numtwo = TheCurrentDigital;
                    CardParentObject.transform.GetChild(TheCurrentDigital).GetComponent<Button>().onClick.Add(() => { KapianMiaosu(value, numtwo, ardpackage.Info[value].Count[numtwo]); });
                }
              

            }
             SetActiveTrue(Obj_PoPup);
        }

        private int DangKapaiNumber = 0;
        private void KapianMiaosu(int prints,int numbers,int numtwo) //点击卡包里面卡片的描述弹窗
        {
           // Obj_CardStory.transform.GetChild(0).GetComponent<Image>().sprite = CardResources.Get<Sprite>(prints + "-" + (numbers + 1));
            Obj_CardStory.transform.GetChild(0).GetComponent<Image>().sprite = CardResources.Get<Sprite>("1" + "-" + (numbers + 1));
            DangKapaiNumber = numtwo;
            if (DangKapaiNumber>1)
            {
                Btn_PresentCard.GetComponent<Image>().material = null;
               OnsetEnadlenTrue(Btn_PresentCard);
            }
            else
            {
                Btn_PresentCard.GetComponent<Image>().material =ShaderFei;
                 OnsetEnadlenFalse(Btn_PresentCard);
            }
             SetActiveTrue(Obj_CardStory);
        }
        private void OnBtnexitkapian()
        {
                   SetActiveFalse(Obj_PoPup);
        }
        private void OnBtnKapaishop()
        {
            throw new NotImplementedException();
        }

        private void OnBtnkapaitishi()
        {
               SetActiveTrue(Obj_The_CARDS_suggest);
        }

        private void OnBtnkapaibangzu()
        {

        }

        private void OnBtntuichutishi()
        {
                  SetActiveFalse(Obj_The_CARDS_suggest);
        }

        private void OnBtnkapaizengsong()
        {
         
        }

        private void OnBtnExitkapaimiaosu()
        {
                  SetActiveFalse(Obj_CardStory);
        }

        #endregion


        #region//商城 

        private async ETVoid GetShopinfo()
        {
            try
            {
                G2C_GetShopList g2cshoplist = (G2C_GetShopList)await SessionComponent.Instance.Session.Call(new C2G_GetShopList());//发送消息收到回调
                if (g2cshoplist.Error != ErrorCode.ERR_Success) //不成功
                {
                    Log.Debug("==========================不成功");
                    return;
                }
                Log.Debug("==============成功");

                SetShop(g2cshoplist);
            }
            catch (Exception e)
            {
                Log.Debug("==============!成功");
                Log.Error(e);
            }
        }
        public void SetShop(G2C_GetShopList shoplistinfo) 
        {
            for (int TheCurrentDigital = 0; TheCurrentDigital < shoplistinfo.Infos.Count; TheCurrentDigital++)
            {
                if (shoplistinfo.Infos[TheCurrentDigital].ItemID>=1&& shoplistinfo.Infos[TheCurrentDigital].ItemID<=6)
                {
                    Obj_BuyEnergy.transform.Find("" + shoplistinfo.Infos[TheCurrentDigital].ItemID).GetChild(1).GetComponent<Text>().text = shoplistinfo.Infos[TheCurrentDigital].ItemDetailCounts[0].ToString();
                    Obj_BuyEnergy.transform.Find("" + shoplistinfo.Infos[TheCurrentDigital].ItemID).GetChild(2).GetChild(0).GetComponent<Text>().text = "＄" + (shoplistinfo.Infos[TheCurrentDigital].ItemMoney/(float)100).ToString();

                }
                if (shoplistinfo.Infos[TheCurrentDigital].ItemID >= 7 && shoplistinfo.Infos[TheCurrentDigital].ItemID <= 12)
                {
                    Obj_BuyGoid.transform.Find("" + shoplistinfo.Infos[TheCurrentDigital].ItemID).GetChild(1).GetComponent<Text>().text = "X"+shoplistinfo.Infos[TheCurrentDigital].ItemDetailCounts[0].ToString();
                    Obj_BuyGoid.transform.Find("" + shoplistinfo.Infos[TheCurrentDigital].ItemID).GetChild(2).GetChild(0).GetComponent<Text>().text = "＄" + (shoplistinfo.Infos[TheCurrentDigital].ItemMoney / (float)100).ToString();


                }
                if (shoplistinfo.Infos[TheCurrentDigital].ItemID >= 13 && shoplistinfo.Infos[TheCurrentDigital].ItemID <= 17)
                {
                    Obj_PhysicalFood.transform.Find("" + shoplistinfo.Infos[TheCurrentDigital].ItemID).GetChild(1).GetComponent<Text>().text = "X" + shoplistinfo.Infos[TheCurrentDigital].ItemDetailCounts[0].ToString();
                    Obj_PhysicalFood.transform.Find("" + shoplistinfo.Infos[TheCurrentDigital].ItemID).GetChild(3).GetComponent<Text>().text = "X" + shoplistinfo.Infos[TheCurrentDigital].ItemDetailCounts[1].ToString();
                    Obj_PhysicalFood.transform.Find("" + shoplistinfo.Infos[TheCurrentDigital].ItemID).GetChild(4).GetChild(0).GetComponent<Text>().text = "＄" + (shoplistinfo.Infos[TheCurrentDigital].ItemMoney / (float)100).ToString();


                }

            }
           
        
        }
        #endregion


        #region//宠物界面s
        private void Cptinfo() 
        {

            Getcptinfo().Coroutine();
        }

        private G2C_GetPetList petlist;
        private async ETVoid Getcptinfo()
        {
            try
            {
                G2C_GetPetList getPetlist = (G2C_GetPetList)await SessionComponent.Instance.Session.Call(new C2G_GetPetList());//发送消息收到回调
                if (getPetlist.Error != ErrorCode.ERR_Success) //不成功
                {
                    Log.Debug("==========================不成功"+ getPetlist.Message);
                    return;
                }
                Log.Debug("==============成功"+ getPetlist.Infos.Count);
                petlist = getPetlist;
                Txt_cwzynengliangtxt.text = Selfinformation.Info.PowerCount.ToString();
                Txt_cwzyshiwutxt.text = Selfinformation.Info.FoodCount.ToString();
                if (Selfinformation.Info.PetID>0)//有携带宠物
                {
                    for (int TheCurrentDigital = 0; TheCurrentDigital < Obj_chongwuMask.transform.childCount; TheCurrentDigital++)//获取物体下子物体数量
                    {
                          OnsetEnadlenTrue(Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("Btn_Creaturexiedai").GetComponent<Button>());
                        Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("Btn_Creaturexiedai").GetComponent<Image>().sprite = PetResources.Get<Sprite>("chpngwu_mei");
                        Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("Btn_Creaturexiedai/Text").GetComponent<Text>().text = "已 携 带";
                    }
                }
                else
                {
                    for (int TheCurrentDigital = 0; TheCurrentDigital < Obj_chongwuMask.transform.childCount; TheCurrentDigital++)//获取物体下子物体数量
                    {
                            OnsetEnadlenFalse(Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("Btn_Creaturexiedai").GetComponent<Button>());
                        Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("Btn_Creaturexiedai").GetComponent<Image>().sprite = PetResources.Get<Sprite>("Chongwu_dai");
                        Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("Btn_Creaturexiedai/Text").GetComponent<Text>().text = "携 带";
                    }

                }
                for (int TheCurrentDigital = 0; TheCurrentDigital < getPetlist.Infos.Count; TheCurrentDigital++)
                {
                    Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("info/Txt_name").GetComponent<Text>().text = getPetlist.Infos[TheCurrentDigital].NickName;
                    Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("info/Obj_jinyan/Image/Text").GetComponent<Text>().text = getPetlist.Infos[TheCurrentDigital].Lev.ToString();
                    Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("info/Obj_jinyan/Text").GetComponent<Text>().text = TransUnit(getPetlist.Infos[TheCurrentDigital].CurrExp) + "/" + TransUnit(getPetlist.Infos[TheCurrentDigital].Exp);
                           SetActiveFalse(Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("info/Obj_qidai").gameObject);
                        SetActiveFalse(Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("info/Obj_weijiesuo").gameObject);
                      SetActiveTrue(Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("info/Obj_jinyan").gameObject);
                    SetActiveTrue(Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("info/Txt_name").gameObject);
                      OnsetEnadlenFalse(Obj_chongwuMask.transform.GetChild(0).GetChild(TheCurrentDigital).Find("Img_chongwu").GetComponent<Button>());
                }
                SetActiveTrue(Obj_ChongwuObj);
            }
            catch (Exception e)
            {
                Log.Debug("==============!成功");
                Log.Error(e);
            }
        }

        //点击宠物
        private void OnsetCwtc(int number) 
        {
            Txt_chongwuname.text = petlist.Infos[number].NickName;
            Txt_twlv.text = petlist.Infos[number].Lev.ToString();
            Txt_Jinyan.text = TransUnit(petlist.Infos[number].CurrExp) + "/" + TransUnit(petlist.Infos[number].Exp);
            Img_amount.fillAmount = petlist.Infos[number].CurrExp / (float)petlist.Infos[number].Exp;
            Txt_molizhi.text = petlist.Infos[number].PowerValue + "/100";
            Txt_miaosu.text = "双倍收益";
            Txt_miaosu1.text = "触发型被动技能，在帮助玩家偷取是，有机率获得2倍的收益";
            Txt_cwshengjitxt.text = Selfinformation.Info.FoodCount.ToString();
            Txt_cwnengliangtxt.text = Selfinformation.Info.PowerCount.ToString();
              SetActiveTrue(Obj_CwTanchuang.gameObject);

            //升级或者恢复能量 传id  petlist.Infos[number].PetID;


        }
        private void OnBtnexitchongwu() 
        {
                  SetActiveFalse(Obj_ChongwuObj);
        }

        private void OnBtnchongwuhelp()
        {
             SetActiveTrue(Obj_chongwuhelp);
        }

        private void OnBtnmianfei()
        {
            throw new NotImplementedException();
        }

        private void OnBtnhuifunengliang()
        {
            throw new NotImplementedException();
        }

        private void OnBtnshengji()
        {
            throw new NotImplementedException();
        }

        private void OnBtnExitcwHelp()
        {
                 SetActiveFalse(Obj_chongwuhelp);
        }

        private void OnBtnExitcwtc()
        {
                   SetActiveFalse(Obj_CwTanchuang.gameObject);//谷歌内购,firebase推送,facebook登录.
        }
        /// <summary>
        /// 数字单位转换
        /// </summary>
        /// <param name="value">数值</param>
        /// <returns></returns>
        public  string TransUnit(long value)
        {
            if (value >= 1000000000000)
            {
                return value / 1000000000000 + "T";
            }
            else if (value >= 1000000000)
            {
                return value / 1000000000 + "B";
            }
            else if (value >= 1000000)
            {
                return value / 1000000 + "M";
            }
            else if (value >= 1000)
            {
                return value / 1000 + "K";
            }
            else
            {
                return value.ToString();
            }
        }

        #endregion
    }
}
